Code

Merge branch 'maint'
authorShawn O. Pearce <spearce@spearce.org>
Thu, 18 Oct 2007 07:11:17 +0000 (03:11 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 18 Oct 2007 07:11:17 +0000 (03:11 -0400)
* maint:
  Yet more 1.5.3.5 fixes mentioned in release notes
  cvsserver: Use exit 1 instead of die when req_Root fails.
  git-blame shouldn't crash if run in an unmerged tree
  git-config: print error message if the config file cannot be read
  fixing output of non-fast-forward output of post-receive-email

Documentation/RelNotes-1.5.3.5.txt
builtin-config.c
contrib/hooks/post-receive-email
git-cvsserver.perl
read-cache.c
t/t8004-blame.sh [new file with mode: 0755]

index de38a84ad634eb42f630c12c007ee47f3fd3450b..78df418257c384107759d4aeaa1dd94bb7316b03 100644 (file)
@@ -10,9 +10,14 @@ Fixes since v1.5.3.4
  * "git-config --file" failed if the argument used a relative path
    as it changed directories before opening the file.
 
+ * "git-config --file" now displays a proper error message if it
+   cannot read the file specified on the command line.
+
  * "git-config", "git-diff", "git-apply" failed if run from a
    subdirectory with relative GIT_DIR and GIT_WORK_TREE set.
 
+ * "git-blame" crashed if run during a merge conflict.
+
  * "git-add -i" did not handle single line hunks correctly.
 
  * "git-rebase -i" failed if external diff drivers were used for one
@@ -33,6 +38,9 @@ Fixes since v1.5.3.4
 
  * "git-instaweb" no longer fails on Mac OS X.
 
+ * post-receive-email example hook fixed was fixed for
+   non-fast-forward updates.
+
  * Documentation updates for supported (but previously undocumented)
    options of "git-archive" and "git-reflog".
 
index d98b6c2c4cbbec367e498d33c5f670709dcac893..e5e243f27cb7ecab11ac0933a361d066f5b35ea9 100644 (file)
@@ -175,7 +175,10 @@ int cmd_config(int argc, const char **argv, const char *prefix)
                else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l")) {
                        if (argc != 2)
                                usage(git_config_set_usage);
-                       return git_config(show_all_config);
+                       if (git_config(show_all_config) < 0 && file && errno)
+                               die("unable to read config file %s: %s", file,
+                                   strerror(errno));
+                       return 0;
                }
                else if (!strcmp(argv[1], "--global")) {
                        char *home = getenv("HOME");
index b188aa3d67eda77b168c61a53162a25abcc56e7d..2aa9bb501c2768770d8aed5de93dda8afc29b427 100644 (file)
@@ -331,7 +331,7 @@ generate_update_branch_email()
                echo "       via  $rev ($revtype)"
        done
 
-       if [ -z "$fastforward" ]; then
+       if [ "$fast_forward" ]; then
                echo "      from  $oldrev ($oldrev_type)"
        else
                #  1. Existing revisions were removed.  In this case newrev is a
index 13dbd27a80adfee43ed6282041b948bd92e5cc12..0d55fec04fa7e3e2a02987543a857a26ae1f96cb 100755 (executable)
@@ -145,8 +145,10 @@ if ($state->{method} eq 'pserver') {
     }
     my $request = $1;
     $line = <STDIN>; chomp $line;
-    req_Root('root', $line) # reuse Root
-       or die "E Invalid root $line \n";
+    unless (req_Root('root', $line)) { # reuse Root
+       print "E Invalid root $line \n";
+       exit 1;
+    }
     $line = <STDIN>; chomp $line;
     unless ($line eq 'anonymous') {
        print "E Only anonymous user allowed via pserver\n";
index 56202d13dfcfe4ed583fee7b4063596bc1ef417e..056b322fb0c83aeda378f548e13f84d4a65c1e29 100644 (file)
@@ -149,6 +149,8 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
                else if (ce_compare_gitlink(ce))
                        changed |= DATA_CHANGED;
                return changed;
+       case 0: /* Special case: unmerged file in index */
+               return MODE_CHANGED | DATA_CHANGED | TYPE_CHANGED;
        default:
                die("internal error: ce_mode is %o", ntohl(ce->ce_mode));
        }
diff --git a/t/t8004-blame.sh b/t/t8004-blame.sh
new file mode 100755 (executable)
index 0000000..ba19ac1
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+# Based on a test case submitted by Björn Steinbrink.
+
+test_description='git blame on conflicted files'
+. ./test-lib.sh
+
+test_expect_success 'setup first case' '
+       # Create the old file
+       echo "Old line" > file1 &&
+       git add file1 &&
+       git commit --author "Old Line <ol@localhost>" -m file1.a &&
+
+       # Branch
+       git checkout -b foo &&
+
+       # Do an ugly move and change
+       git rm file1 &&
+       echo "New line ..."  > file2 &&
+       echo "... and more" >> file2 &&
+       git add file2 &&
+       git commit --author "U Gly <ug@localhost>" -m ugly &&
+
+       # Back to master and change something
+       git checkout master &&
+       echo "
+
+bla" >> file1 &&
+       git commit --author "Old Line <ol@localhost>" -a -m file1.b &&
+
+       # Back to foo and merge master
+       git checkout foo &&
+       if git merge master; then
+               echo needed conflict here
+               exit 1
+       else
+               echo merge failed - resolving automatically
+       fi &&
+       echo "New line ...
+... and more
+
+bla
+Even more" > file2 &&
+       git rm file1 &&
+       git commit --author "M Result <mr@localhost>" -a -m merged &&
+
+       # Back to master and change file1 again
+       git checkout master &&
+       sed s/bla/foo/ <file1 >X &&
+       rm file1 &&
+       mv X file1 &&
+       git commit --author "No Bla <nb@localhost>" -a -m replace &&
+
+       # Try to merge into foo again
+       git checkout foo &&
+       if git merge master; then
+               echo needed conflict here
+               exit 1
+       else
+               echo merge failed - test is setup
+       fi
+'
+
+test_expect_success \
+       'blame runs on unconflicted file while other file has conflicts' '
+       git blame file2
+'
+
+test_expect_success 'blame runs on conflicted file in stages 1,3' '
+       git blame file1
+'
+
+test_done