提交 92702392 编写于 作者: E Elijah Newren 提交者: Junio C Hamano

merge-recursive: make sure when we say we abort that we actually abort

In commit 65170c07 ("merge-recursive: avoid incorporating uncommitted
changes in a merge", 2017-12-21), it was noted that there was a special
case when merge-recursive didn't rely on unpack_trees() to enforce the
index == HEAD requirement, and thus that it needed to do that enforcement
itself.  Unfortunately, it returned the wrong exit status, signalling that
the merge completed but had conflicts, rather than that it was aborted.
Fix the return code, and while we're at it, change the error message to
match what unpack_trees() would have printed.
Signed-off-by: NElijah Newren <newren@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 cf69f2af
......@@ -1984,9 +1984,9 @@ int merge_trees(struct merge_options *o,
struct strbuf sb = STRBUF_INIT;
if (!o->call_depth && index_has_changes(&the_index, &sb)) {
err(o, _("Dirty index: cannot merge (dirty: %s)"),
err(o, _("Your local changes to the following files would be overwritten by merge:\n %s"),
sb.buf);
return 0;
return -1;
}
output(o, 0, _("Already up to date!"));
*result = head;
......
......@@ -116,7 +116,7 @@ test_expect_success 'recursive' '
test_path_is_missing .git/MERGE_HEAD
'
test_expect_failure 'recursive, when merge branch matches merge base' '
test_expect_success 'recursive, when merge branch matches merge base' '
git reset --hard &&
git checkout B^0 &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册