Skip to content

Commit d836118

Browse files
committed
Merge branch 'cb/maint-no-double-merge' into maint
* cb/maint-no-double-merge: refuse to merge during a merge
2 parents 6019b3c + c8c562a commit d836118

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

builtin-merge.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
836836
struct commit_list **remotes = &remoteheads;
837837

838838
setup_work_tree();
839+
if (file_exists(git_path("MERGE_HEAD")))
840+
die("You have not concluded your merge. (MERGE_HEAD exists)");
839841
if (read_cache_unmerged())
840-
die("You are in the middle of a conflicted merge.");
842+
die("You are in the middle of a conflicted merge."
843+
" (index unmerged)");
841844

842845
/*
843846
* Check if we are _not_ on a detached HEAD, i.e. if there is a

t/t3030-merge-recursive.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ test_expect_success 'fail if the index has unresolved entries' '
276276
277277
test_must_fail git merge "$c5" &&
278278
test_must_fail git merge "$c5" 2> out &&
279+
grep "You have not concluded your merge" out &&
280+
rm -f .git/MERGE_HEAD &&
281+
test_must_fail git merge "$c5" 2> out &&
279282
grep "You are in the middle of a conflicted merge" out
280283
281284
'

0 commit comments

Comments
 (0)