From a2d6b872dbf4e65525c9ba55e820e2ea26011ce1 Mon Sep 17 00:00:00 2001 From: Robert Schiele Date: Thu, 18 Oct 2007 00:27:51 +0200 Subject: fixing output of non-fast-forward output of post-receive-email post-receive-email has one place where the variable fast_forward is not spelled correctly. At the same place the logic was reversed. The combination of both bugs made the script work correctly for fast-forward commits but not for non-fast-forward ones. This change fixes this to be correct in both cases. Signed-off-by: Robert Schiele Signed-off-by: Shawn O. Pearce diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email index cbbd02f..28a06c7 100644 --- a/contrib/hooks/post-receive-email +++ b/contrib/hooks/post-receive-email @@ -323,7 +323,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 -- cgit v0.10.2-6-g49f6 From 93a56c2cf7c8b29ca4c5e0740fe1e487324ffc73 Mon Sep 17 00:00:00 2001 From: Gerrit Pape Date: Fri, 12 Oct 2007 11:40:57 +0000 Subject: git-config: print error message if the config file cannot be read Instead of simply exiting with 255, print an error message including the reason why a config file specified through --file cannot be opened or read. The problem was noticed by Joey Hess, reported through http://bugs.debian.org/445208 Signed-off-by: Shawn O. Pearce diff --git a/builtin-config.c b/builtin-config.c index d98b6c2..e5e243f 100644 --- a/builtin-config.c +++ b/builtin-config.c @@ -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"); -- cgit v0.10.2-6-g49f6 From cd8ae20195ae09c06d0854f1ebf92d1f1164c927 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 18 Oct 2007 02:31:30 -0400 Subject: git-blame shouldn't crash if run in an unmerged tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we are in the middle of resolving a merge conflict there may be one or more files whose entries in the index represent an unmerged state (index entries in the higher-order stages). Attempting to run git-blame on any file in such a working directory resulted in "fatal: internal error: ce_mode is 0" as we use the magic marker for an unmerged entry is 0 (set up by things like diff-lib.c's do_diff_cache() and builtin-read-tree.c's read_tree_unmerged()) and the ce_match_stat_basic() function gets upset about this. I'm not entirely sure that the whole "ce_mode = 0" case is a good idea to begin with, and maybe the right thing to do is to remove that horrid freakish special case, but removing the internal error seems to be the simplest fix for now. Linus [sp: Thanks to Björn Steinbrink for the test case] Signed-off-by: Shawn O. Pearce diff --git a/read-cache.c b/read-cache.c index 536f4d0..928e8fa 100644 --- a/read-cache.c +++ b/read-cache.c @@ -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 index 0000000..ba19ac1 --- /dev/null +++ b/t/t8004-blame.sh @@ -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 " -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 " -m ugly && + + # Back to master and change something + git checkout master && + echo " + +bla" >> file1 && + git commit --author "Old Line " -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 " -a -m merged && + + # Back to master and change file1 again + git checkout master && + sed s/bla/foo/ X && + rm file1 && + mv X file1 && + git commit --author "No Bla " -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 -- cgit v0.10.2-6-g49f6 From 2a4b5d5a0701a5f9a953883e21a6e3dc71cd5cc7 Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Wed, 17 Oct 2007 10:05:47 -0400 Subject: cvsserver: Use exit 1 instead of die when req_Root fails. This was causing test failures because die was exiting 255. Signed-off-by: Brian Gernhardt Signed-off-by: Shawn O. Pearce diff --git a/git-cvsserver.perl b/git-cvsserver.perl index 13dbd27..0d55fec 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -145,8 +145,10 @@ if ($state->{method} eq 'pserver') { } my $request = $1; $line = ; 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 = ; chomp $line; unless ($line eq 'anonymous') { print "E Only anonymous user allowed via pserver\n"; -- cgit v0.10.2-6-g49f6 From 1aa3d01f870a68dc46a872c83f9cd051f172f9b3 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 18 Oct 2007 03:11:03 -0400 Subject: Yet more 1.5.3.5 fixes mentioned in release notes Signed-off-by: Shawn O. Pearce diff --git a/Documentation/RelNotes-1.5.3.5.txt b/Documentation/RelNotes-1.5.3.5.txt index de38a84..78df418 100644 --- a/Documentation/RelNotes-1.5.3.5.txt +++ b/Documentation/RelNotes-1.5.3.5.txt @@ -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". -- cgit v0.10.2-6-g49f6