mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
Merge branch 'ap/merge-stop-at-prepare-commit-msg-failure' into maint
"git merge" started calling prepare-commit-msg hook like "git commit" does some time ago, but forgot to pay attention to the exit status of the hook. * ap/merge-stop-at-prepare-commit-msg-failure: merge: Honor prepare-commit-msg return code
This commit is contained in:
commit
b663af57c3
|
@ -800,8 +800,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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue