Skip to content

Commit 587421e

Browse files
newrengitster
authored andcommitted
t7405: verify 'merge --abort' works after submodule/path conflicts
Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e81c7d4 commit 587421e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

t/t7405-submodule-merge.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,19 @@ test_expect_failure 'file/submodule conflict' '
333333
)
334334
'
335335

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+
336349
# Directory/submodule conflict
337350
# Commit O: <empty>
338351
# 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
417430
# merge from starting; we should not be writing to such paths
418431
# anyway.
419432
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 &&
420441
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
421452
)
422453
'
423454

0 commit comments

Comments
 (0)