@@ -13,8 +13,10 @@ Initial setup:
1313 -- B -- (first)
1414 / \
1515 A - C - D - E - H (master)
16- \ /
17- F - G (second)
16+ \ \ /
17+ \ F - G (second)
18+ \
19+ Conflicting-G
1820'
1921. ./test-lib.sh
2022. " $TEST_DIRECTORY " /lib-rebase.sh
@@ -49,7 +51,9 @@ test_expect_success 'setup' '
4951 git merge --no-commit G &&
5052 test_tick &&
5153 git commit -m H &&
52- git tag -m H H
54+ git tag -m H H &&
55+ git checkout A &&
56+ test_commit conflicting-G G.t
5357'
5458
5559test_expect_success ' create completely different structure' '
@@ -72,7 +76,7 @@ test_expect_success 'create completely different structure' '
7276 EOF
7377 test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
7478 test_tick &&
75- git rebase -i -r A &&
79+ git rebase -i -r A master &&
7680 test_cmp_graph <<-\EOF
7781 * Merge the topic branch ' \' ' onebranch' \' '
7882 |\
@@ -125,7 +129,7 @@ test_expect_success '`reset` refuses to overwrite untracked files' '
125129 git rebase --abort
126130'
127131
128- test_expect_success ' failed `merge` writes patch (may be rescheduled, too)' '
132+ test_expect_success ' failed `merge -C ` writes patch (may be rescheduled, too)' '
129133 test_when_finished "test_might_fail git rebase --abort" &&
130134 git checkout -b conflicting-merge A &&
131135
@@ -141,13 +145,25 @@ test_expect_success 'failed `merge` writes patch (may be rescheduled, too)' '
141145
142146 : fail because of merge conflict &&
143147 rm G.t .git/rebase-merge/patch &&
144- git reset --hard &&
145- test_commit conflicting-G G.t not-G conflicting-G &&
148+ git reset --hard conflicting-G &&
146149 test_must_fail git rebase --continue &&
147150 ! grep "^merge -C .* G$" .git/rebase-merge/git-rebase-todo &&
148151 test_path_is_file .git/rebase-merge/patch
149152'
150153
154+ SQ=" '"
155+ test_expect_success ' failed `merge <branch>` does not crash' '
156+ test_when_finished "test_might_fail git rebase --abort" &&
157+ git checkout conflicting-G &&
158+
159+ echo "merge G" >script-from-scratch &&
160+ test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
161+ test_tick &&
162+ test_must_fail git rebase -ir HEAD &&
163+ ! grep "^merge G$" .git/rebase-merge/git-rebase-todo &&
164+ grep "^Merge branch ${SQ}G${SQ}$" .git/rebase-merge/message
165+ '
166+
151167test_expect_success ' with a branch tip that was cherry-picked already' '
152168 git checkout -b already-upstream master &&
153169 base="$(git rev-parse --verify HEAD)" &&
0 commit comments