@@ -115,15 +115,23 @@ test_expect_success '--skip after failed fixup cleans commit message' '
115115 test_when_finished "test_might_fail git rebase --abort" &&
116116 git checkout -b with-conflicting-fixup &&
117117 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 &&
121121 test_must_fail env FAKE_LINES="1 fixup 2 squash 4" \
122122 git rebase -i HEAD~4 &&
123123
124124 : 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
127135
128136 : skip and continue &&
129137 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' '
133141 test_path_is_missing .git/copy.txt &&
134142
135143 : 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 &&
138145
139146 : now, let us ensure that "squash" is handled correctly &&
140147 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 " \
142149 git rebase -i HEAD~4 &&
143150
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 &&
145152 (test_set_editor "$PWD/copy-editor.sh" &&
146153 test_must_fail git rebase --skip) &&
147154
148155 : not the final squash, no need to edit the commit message &&
149156 test_path_is_missing .git/copy.txt &&
150157
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
155173
156174 (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
159182
160183 : 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
163187'
164188
165189test_expect_success ' setup rerere database' '
0 commit comments