@@ -13,8 +13,10 @@ Initial setup:
13
13
-- B -- (first)
14
14
/ \
15
15
A - C - D - E - H (master)
16
- \ /
17
- F - G (second)
16
+ \ \ /
17
+ \ F - G (second)
18
+ \
19
+ Conflicting-G
18
20
'
19
21
. ./test-lib.sh
20
22
. " $TEST_DIRECTORY " /lib-rebase.sh
@@ -49,7 +51,9 @@ test_expect_success 'setup' '
49
51
git merge --no-commit G &&
50
52
test_tick &&
51
53
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
53
57
'
54
58
55
59
test_expect_success ' create completely different structure' '
@@ -72,7 +76,7 @@ test_expect_success 'create completely different structure' '
72
76
EOF
73
77
test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
74
78
test_tick &&
75
- git rebase -i -r A &&
79
+ git rebase -i -r A master &&
76
80
test_cmp_graph <<-\EOF
77
81
* Merge the topic branch ' \' ' onebranch' \' '
78
82
|\
@@ -125,7 +129,7 @@ test_expect_success '`reset` refuses to overwrite untracked files' '
125
129
git rebase --abort
126
130
'
127
131
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)' '
129
133
test_when_finished "test_might_fail git rebase --abort" &&
130
134
git checkout -b conflicting-merge A &&
131
135
@@ -141,13 +145,25 @@ test_expect_success 'failed `merge` writes patch (may be rescheduled, too)' '
141
145
142
146
: fail because of merge conflict &&
143
147
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 &&
146
149
test_must_fail git rebase --continue &&
147
150
! grep "^merge -C .* G$" .git/rebase-merge/git-rebase-todo &&
148
151
test_path_is_file .git/rebase-merge/patch
149
152
'
150
153
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
+
151
167
test_expect_success ' with a branch tip that was cherry-picked already' '
152
168
git checkout -b already-upstream master &&
153
169
base="$(git rev-parse --verify HEAD)" &&
0 commit comments