summaryrefslogtreecommitdiff
path: root/t/t7502-commit.sh
diff options
context:
space:
mode:
authorBrandon Casey <drafnel@gmail.com>2013-02-18 20:17:04 -0800
committerJunio C Hamano <gitster@pobox.com>2013-02-19 09:29:13 -0800
commit67dabab05820d97df175c724123b1232ff8d051d (patch)
treec8b4e74452ec043cc59e1b31a9214cda433dcb5c /t/t7502-commit.sh
parent20a599e2c18dd5b491257d7f8aeb2d2f02221595 (diff)
downloadgit-67dabab05820d97df175c724123b1232ff8d051d.tar.gz
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 <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7502-commit.sh')
-rwxr-xr-xt/t7502-commit.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index cbd7a45927..9040f8ad5e 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -181,8 +181,8 @@ test_expect_success 'cleanup commit messages (verbatim option,-t)' '
echo >>negative &&
{ echo;echo "# text";echo; } >expect &&
- git commit --cleanup=verbatim -t expect -a &&
- git cat-file -p HEAD |sed -e "1,/^\$/d" |head -n 3 >actual &&
+ git commit --cleanup=verbatim --no-status -t expect -a &&
+ git cat-file -p HEAD |sed -e "1,/^\$/d" >actual &&
test_cmp expect actual
'