summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Antoine Pelisse <apelisse@gmail.com>2013-01-02 19:42:50 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-01-03 09:10:11 -0800
commit3e4141d08c8dc1964d53c2ce13de8876d29e6436 (patch)
tree44211fc071d585ac9ab7700d48c4f7e31baa322d /builtin
parentGit 1.8.0.3 (diff)
downloadtgif-3e4141d08c8dc1964d53c2ce13de8876d29e6436.tar.xz
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 'builtin')
-rw-r--r--builtin/merge.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index 0ec8f0d449..1aef5ea9ab 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -903,8 +903,9 @@ static void prepare_to_commit(struct commit_list *remoteheads)
if (0 < option_edit)
strbuf_add_lines(&msg, "# ", comment, strlen(comment));
write_merge_msg(&msg);
- run_hook(get_index_file(), "prepare-commit-msg",
- git_path("MERGE_MSG"), "merge", NULL, NULL);
+ if (run_hook(get_index_file(), "prepare-commit-msg",
+ git_path("MERGE_MSG"), "merge", NULL, NULL))
+ abort_commit(remoteheads, NULL);
if (0 < option_edit) {
if (launch_editor(git_path("MERGE_MSG"), NULL, NULL))
abort_commit(remoteheads, NULL);