summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2013-03-21 14:02:37 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-03-21 14:02:37 -0700
commit54797b98b85cfe7e0e6ea1cbf314981456bd047e (patch)
treefdf064e48c5272dd3f860494441bfa84b9ded9c7 /t
parentMerge branch 'nd/count-garbage' (diff)
parentDocumentation/git-commit.txt: rework the --cleanup section (diff)
downloadtgif-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')
-rwxr-xr-xt/t7502-commit.sh16
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