Various fixes around "git am" that applies a patch to a history
that is not there yet.
* pt/am-abort-fix:
am --abort: keep unrelated commits on unborn branch
am --abort: support aborting to unborn branch
am --abort: revert changes introduced by failed 3way merge
am --skip: support skipping while on unborn branch
am -3: support 3way merge on unborn branch
am --skip: revert changes introduced by failed 3way merge
test_expect_success 'am --abort will keep the local commits intact' '
test_must_fail git am 0004-*.patch &&
test_commit unrelated &&
@ -72,4 +95,62 @@ test_expect_success 'am --abort will keep the local commits intact' '
@@ -72,4 +95,62 @@ 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_expect_success 'am -3 --skip clears index on unborn branch' '
test_path_is_dir .git/rebase-apply &&
echo tmpfile >tmpfile &&
git add tmpfile &&
git am --skip &&
test -z "$(git ls-files)" &&
test_path_is_missing otherfile-4 &&
test_path_is_missing tmpfile
'
test_expect_success 'am -3 --abort removes otherfile-4 on unborn branch' '