t7405: verify 'merge --abort' works after submodule/path conflicts

Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Jul 10, 2018 at 20:56 UTC 587421ebddec17e6e9aaf55b61aa40ad4ad9e43e
1 file changed +31
t/t7405-submodule-merge.sh
+31
@@ -333,6 +333,19 @@ test_expect_failure 'file/submodule conflict' '
333 )
334 '
335
336 +test_expect_success 'file/submodule conflict; merge --abort works afterward' '
337 + test_when_finished "git -C file-submodule reset --hard" &&
338 + (
339 + cd file-submodule &&
340 +
341 + git checkout A^0 &&
342 + test_must_fail git merge B^0 >out 2>err &&
343 +
344 + test_path_is_file .git/MERGE_HEAD &&
345 + git merge --abort
346 + )
347 +'
348 +
349 # Directory/submodule conflict
350 # Commit O: <empty>
351 # Commit A: path (submodule), with sole tracked file named 'world'
@@ -417,7 +430,25 @@ test_expect_failure 'directory/submodule conflict; should not treat submodule fi
430 # merge from starting; we should not be writing to such paths
431 # anyway.
432 test_i18ngrep ! "refusing to lose untracked file at" err
433 + )
434 +'
435 +
436 +test_expect_failure 'directory/submodule conflict; merge --abort works afterward' '
437 + test_when_finished "git -C directory-submodule/path reset --hard" &&
438 + test_when_finished "git -C directory-submodule reset --hard" &&
439 + (
440 + cd directory-submodule &&
441
442 + git checkout A^0 &&
443 + test_must_fail git merge B2^0 &&
444 + test_path_is_file .git/MERGE_HEAD &&
445 +
446 + # merge --abort should succeed, should clear .git/MERGE_HEAD,
447 + # and should not leave behind any conflicted files
448 + git merge --abort &&
449 + test_path_is_missing .git/MERGE_HEAD &&
450 + git ls-files -u >conflicts &&
451 + test_must_be_empty conflicts
452 )
453 '
454