Skip to content

Commit 67dabab

Browse files
drafnelgitster
authored andcommitted
t/t7502: compare entire commit message with what was expected
This test attempts to verify that a commit in "verbatim" mode, when supplied a commit template, produces a commit in which the commit message matches exactly the template that was supplied. But, since the commit operation appends additional instructions for the user as comments in the commit buffer, which would cause the comparison to fail, this test decided to compare only the first three lines (the length of the template) of the resulting commit message to the original template file. This has two problems. 1. It does not allow the template to be lengthened or shortened without also modifying the number of lines that are considered significant (i.e. the argument to 'head -n'). 2. It will not catch a bug in git that causes git to append additional lines to the commit message. So, let's use the --no-status option to 'git commit' which will cause git to refrain from appending the lines of instructional text to the commit message. This will allow the entire resulting commit message to be compared against the expected value. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 20a599e commit 67dabab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

t/t7502-commit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ test_expect_success 'cleanup commit messages (verbatim option,-t)' '
181181
182182
echo >>negative &&
183183
{ echo;echo "# text";echo; } >expect &&
184-
git commit --cleanup=verbatim -t expect -a &&
185-
git cat-file -p HEAD |sed -e "1,/^\$/d" |head -n 3 >actual &&
184+
git commit --cleanup=verbatim --no-status -t expect -a &&
185+
git cat-file -p HEAD |sed -e "1,/^\$/d" >actual &&
186186
test_cmp expect actual
187187
188188
'

0 commit comments

Comments
 (0)