am -3: support 3way merge on unborn branch
While on an unborn branch, git am -3 will fail to do a threeway merge as it references HEAD as "our tree", but HEAD does not point to a valid tree. Fix this by using an empty tree as "our tree" when we are on an unborn branch. Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -83,4 +83,13 @@ test_expect_success 'am --abort will keep the local commits intact' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'am -3 stops on conflict on unborn branch' '
|
||||
git checkout -f --orphan orphan &&
|
||||
git reset &&
|
||||
rm -f otherfile-4 &&
|
||||
test_must_fail git am -3 0003-*.patch &&
|
||||
test 2 -eq $(git ls-files -u | wc -l) &&
|
||||
test 4 = "$(cat otherfile-4)"
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Reference in New Issue
Block a user