@@ -115,15 +115,23 @@ test_expect_success '--skip after failed fixup cleans commit message' '
115
115
test_when_finished "test_might_fail git rebase --abort" &&
116
116
git checkout -b with-conflicting-fixup &&
117
117
test_commit wants-fixup &&
118
- test_commit "fixup! wants-fixup " wants-fixup.t 1 wants-fixup-1 &&
119
- test_commit "fixup! wants-fixup " wants-fixup.t 2 wants-fixup-2 &&
120
- test_commit "fixup! wants-fixup " wants-fixup.t 3 wants-fixup-3 &&
118
+ test_commit "fixup 1 " wants-fixup.t 1 wants-fixup-1 &&
119
+ test_commit "fixup 2 " wants-fixup.t 2 wants-fixup-2 &&
120
+ test_commit "fixup 3 " wants-fixup.t 3 wants-fixup-3 &&
121
121
test_must_fail env FAKE_LINES="1 fixup 2 squash 4" \
122
122
git rebase -i HEAD~4 &&
123
123
124
124
: now there is a conflict, and comments in the commit message &&
125
- git show HEAD >out &&
126
- grep "fixup! wants-fixup" out &&
125
+ test_commit_message HEAD <<-\EOF &&
126
+ # This is a combination of 2 commits.
127
+ # This is the 1st commit message:
128
+
129
+ wants-fixup
130
+
131
+ # The commit message #2 will be skipped:
132
+
133
+ # fixup 1
134
+ EOF
127
135
128
136
: skip and continue &&
129
137
echo "cp \"\$1\" .git/copy.txt" | write_script copy-editor.sh &&
@@ -133,33 +141,49 @@ test_expect_success '--skip after failed fixup cleans commit message' '
133
141
test_path_is_missing .git/copy.txt &&
134
142
135
143
: now the comments in the commit message should have been cleaned up &&
136
- git show HEAD >out &&
137
- ! grep "fixup! wants-fixup" out &&
144
+ test_commit_message HEAD -m wants-fixup &&
138
145
139
146
: now, let us ensure that "squash" is handled correctly &&
140
147
git reset --hard wants-fixup-3 &&
141
- test_must_fail env FAKE_LINES="1 squash 4 squash 2 squash 4 " \
148
+ test_must_fail env FAKE_LINES="1 squash 2 squash 1 squash 3 squash 1 " \
142
149
git rebase -i HEAD~4 &&
143
150
144
- : the first squash failed, but there are two more in the chain &&
151
+ : the second squash failed, but there are two more in the chain &&
145
152
(test_set_editor "$PWD/copy-editor.sh" &&
146
153
test_must_fail git rebase --skip) &&
147
154
148
155
: not the final squash, no need to edit the commit message &&
149
156
test_path_is_missing .git/copy.txt &&
150
157
151
- : The first squash was skipped, therefore: &&
152
- git show HEAD >out &&
153
- test_i18ngrep "# This is a combination of 2 commits" out &&
154
- test_i18ngrep "# This is the commit message #2:" out &&
158
+ : The first and third squashes succeeded, therefore: &&
159
+ test_commit_message HEAD <<-\EOF &&
160
+ # This is a combination of 3 commits.
161
+ # This is the 1st commit message:
162
+
163
+ wants-fixup
164
+
165
+ # This is the commit message #2:
166
+
167
+ fixup 1
168
+
169
+ # This is the commit message #3:
170
+
171
+ fixup 2
172
+ EOF
155
173
156
174
(test_set_editor "$PWD/copy-editor.sh" && git rebase --skip) &&
157
- git show HEAD >out &&
158
- test_i18ngrep ! "# This is a combination" out &&
175
+ test_commit_message HEAD <<-\EOF &&
176
+ wants-fixup
177
+
178
+ fixup 1
179
+
180
+ fixup 2
181
+ EOF
159
182
160
183
: Final squash failed, but there was still a squash &&
161
- test_i18ngrep "# This is a combination of 2 commits" .git/copy.txt &&
162
- test_i18ngrep "# This is the commit message #2:" .git/copy.txt
184
+ head -n1 .git/copy.txt >first-line &&
185
+ test_i18ngrep "# This is a combination of 3 commits" first-line &&
186
+ test_i18ngrep "# This is the commit message #3:" .git/copy.txt
163
187
'
164
188
165
189
test_expect_success ' setup rerere database' '
0 commit comments