Skip to content

Commit 9ff6b74

Browse files
charvi-077gitster
authored andcommitted
t/t3437: fixup the test 'multiple fixup -c opens editor once'
In the test, FAKE_COMMIT_MESSAGE replaces the commit message each time it is invoked so there will be only one instance of "Modified-A3" no matter how many times we invoke the editor. Let's fix this and use FAKE_COMMIT_AMEND instead so that it adds "Modified-A3" once for each time the editor is invoked. This patch also removes the check for counting the number of "Modified-A3" lines and instead compares the whole message to check that the commenting code works correctly for 'fixup -c' as well as 'fixup -C'. Mentored-by: Christian Couder <[email protected]> Mentored-by: Phillip Wood <[email protected]> Helped-by: Eric Sunshine <[email protected]> Signed-off-by: Charvi Mendiratta <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9c7650c commit 9ff6b74

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

t/t3437-rebase-fixup-options.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,16 @@ test_expect_success 'first fixup -C commented out in sequence fixup fixup -C fix
197197
test_expect_success 'multiple fixup -c opens editor once' '
198198
test_when_finished "test_might_fail git rebase --abort" &&
199199
git checkout --detach A3 &&
200-
FAKE_COMMIT_MESSAGE="Modified-A3" \
200+
git log -1 --pretty=format:%B >expected-message &&
201+
test_write_lines "" "Modified-A3" >>expected-message &&
202+
FAKE_COMMIT_AMEND="Modified-A3" \
201203
FAKE_LINES="1 fixup_-C 2 fixup_-c 3 fixup_-c 4" \
202204
EXPECT_HEADER_COUNT=4 \
203205
git rebase -i A &&
204206
test_cmp_rev HEAD^ A &&
205207
get_author HEAD >actual-author &&
206208
test_cmp expected-author actual-author &&
207-
test 1 = $(git show | grep Modified-A3 | wc -l)
209+
test_commit_message HEAD expected-message
208210
'
209211

210212
test_expect_success 'sequence squash, fixup & fixup -c gives combined message' '

0 commit comments

Comments
 (0)