Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Pelisse <apelisse@gmail.com>2013-01-02 22:42:50 +0400
committerJunio C Hamano <gitster@pobox.com>2013-01-03 21:10:11 +0400
commit3e4141d08c8dc1964d53c2ce13de8876d29e6436 (patch)
tree44211fc071d585ac9ab7700d48c4f7e31baa322d /t/t7505-prepare-commit-msg-hook.sh
parent15999998fbda60552742275570947431b57108ae (diff)
merge: Honor prepare-commit-msg return code
65969d4 (merge: honor prepare-commit-msg hook, 2011-02-14) tried to make "git commit" and "git merge" consistent, because a merge that required user assistance has to be concluded with "git commit", but back then only "git commit" triggered prepare-commit-msg hook. When it added a call to run the prepare-commit-msg hook, however, it forgot to check the exit code from the hook like "git commit" does, and ended up replacing one inconsistency with another. When prepare-commit-msg hook that is run from "git merge" exits with a non-zero status, abort the commit. Signed-off-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7505-prepare-commit-msg-hook.sh')
-rwxr-xr-xt/t7505-prepare-commit-msg-hook.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh
index 5b4b694f18..357375151d 100755
--- a/t/t7505-prepare-commit-msg-hook.sh
+++ b/t/t7505-prepare-commit-msg-hook.sh
@@ -167,5 +167,19 @@ test_expect_success 'with failing hook (--no-verify)' '
'
+test_expect_success 'with failing hook (merge)' '
+
+ git checkout -B other HEAD@{1} &&
+ echo "more" >> file &&
+ git add file &&
+ rm -f "$HOOK" &&
+ git commit -m other &&
+ write_script "$HOOK" <<-EOF
+ exit 1
+ EOF
+ git checkout - &&
+ test_must_fail git merge other
+
+'
test_done