diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-04-03 09:26:07 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-03 09:26:07 -0700 |
commit | 14c79b1faa113707d8955912af6064d9844f71eb (patch) | |
tree | 0072f315d261bf4c4792ddcba45445facab1e0d1 /t | |
parent | 295e3938fc2e0a229958e2fb76eb8b66fcb3611d (diff) | |
parent | 46fbf7536404257a68fd4ea5d92a3bcb3f7b5848 (diff) | |
download | git-14c79b1faa113707d8955912af6064d9844f71eb.tar.gz |
Merge branch 'bc/commit-complete-lines-given-via-m-option' into maint
'git commit -m "$msg"' used to add an extra newline even when
$msg already ended with one.
* bc/commit-complete-lines-given-via-m-option:
Documentation/git-commit.txt: rework the --cleanup section
git-commit: only append a newline to -m mesg if necessary
t7502: demonstrate breakage with a commit message with trailing newlines
t/t7502: compare entire commit message with what was expected
Diffstat (limited to 't')
-rwxr-xr-x | t/t7502-commit.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh index cbd7a45927..292bc082b2 100755 --- a/t/t7502-commit.sh +++ b/t/t7502-commit.sh @@ -177,12 +177,20 @@ test_expect_success 'verbose respects diff config' ' git config --unset color.diff ' +mesg_with_comment_and_newlines=' +# text + +' + +test_expect_success 'prepare file with comment line and trailing newlines' ' + printf "%s" "$mesg_with_comment_and_newlines" >expect +' + 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 ' @@ -199,7 +207,7 @@ test_expect_success 'cleanup commit messages (verbatim option,-F)' ' test_expect_success 'cleanup commit messages (verbatim option,-m)' ' echo >>negative && - git commit --cleanup=verbatim -m "$(cat expect)" -a && + git commit --cleanup=verbatim -m "$mesg_with_comment_and_newlines" -a && git cat-file -p HEAD |sed -e "1,/^\$/d">actual && test_cmp expect actual |