diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-03-21 14:02:37 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-03-21 14:02:37 -0700 |
commit | 54797b98b85cfe7e0e6ea1cbf314981456bd047e (patch) | |
tree | fdf064e48c5272dd3f860494441bfa84b9ded9c7 /t/t7502-commit.sh | |
parent | Merge branch 'nd/count-garbage' (diff) | |
parent | Documentation/git-commit.txt: rework the --cleanup section (diff) | |
download | tgif-54797b98b85cfe7e0e6ea1cbf314981456bd047e.tar.xz |
Merge branch 'bc/commit-complete-lines-given-via-m-option'
'git commit -m "$str"' when $str was already terminated with a LF
now avoids adding an extra LF to the message.
* 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/t7502-commit.sh')
-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 |