Skip to content

Commit 7b6ad97

Browse files
newrengitster
authored andcommitted
t6006: simplify, fix, and optimize empty message test
Test t6006.71 ("oneline with empty message") was creating two commits with simple commit messages, and then running filter-branch to rewrite the commit messages to be "empty". This test was introduced in commit 1fb5fdd ("rev-list: fix --pretty=oneline with empty message", 2010-03-21) and written this way because the --allow-empty-message option to git commit did not exist at the time. However, the filter-branch invocation used differed slightly from --allow-empty-message in that it would have a commit message consisting solely of a single newline, and as such was not testing what the original commit intended to test. Since both a truly empty commit message and a commit message with a single linefeed could trigger the original bug, modify the test slightly to include an example of each. Despite only being one piece of the 71st test and there being 73 tests overall, this small change to just this one test speeds up the overall execution time of t6006 (as measured by the best of 3 runs of `time ./t6006-rev-list-format.sh`) by about 11% on Linux, 13% on Mac, and about 15% on Windows. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 745f681 commit 7b6ad97

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

t/t6006-rev-list-format.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,8 @@ test_expect_success 'reflog identity' '
501501
'
502502

503503
test_expect_success 'oneline with empty message' '
504-
git commit -m "dummy" --allow-empty &&
505-
git commit -m "dummy" --allow-empty &&
506-
git filter-branch --msg-filter "sed -e s/dummy//" HEAD^^.. &&
504+
git commit --allow-empty --cleanup=verbatim -m "$LF" &&
505+
git commit --allow-empty --allow-empty-message &&
507506
git rev-list --oneline HEAD >test.txt &&
508507
test_line_count = 5 test.txt &&
509508
git rev-list --oneline --graph HEAD >testg.txt &&

0 commit comments

Comments
 (0)