aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2011-05-08 12:31:02 +0200
committerJunio C Hamano <gitster@pobox.com>2011-05-11 11:20:28 -0700
commit8b1ae678a33e2d1ccf3080977b692a59acad9b50 (patch)
treeac17ff9704b6f87743f804cebc4485cf11a04d66 /t
parent4c007ae8351a0a2beba57e2930ed21aed141e51e (diff)
downloadgit-8b1ae678a33e2d1ccf3080977b692a59acad9b50.tar.gz
git-8b1ae678a33e2d1ccf3080977b692a59acad9b50.tar.xz
Do not strip empty lines / trailing spaces from a commit message template
Templates should be just that: A form that the user fills out, and forms have blanks. If people are attached to not having extra whitespace in the editor, they can simply clean up their templates. Added test with editor adding even more whitespace. Signed-off-by: Boris Faure <billiob@gmail.com> Based-on-patch-by:Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t7500-commit.sh14
-rwxr-xr-xt/t7500/add-whitespaced-content8
2 files changed, 22 insertions, 0 deletions
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index bcdf0847d..9ef00906c 100755
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
@@ -123,6 +123,20 @@ test_expect_success 'commit message from file should override template' '
commit_msg_is "standard input msg"
'
+cat >"$TEMPLATE" <<\EOF
+
+
+### template
+
+EOF
+test_expect_success 'commit message from template with whitespace issue' '
+ echo "content galore" >>foo &&
+ git add foo &&
+ GIT_EDITOR="$TEST_DIRECTORY"/t7500/add-whitespaced-content git commit \
+ --template "$TEMPLATE" &&
+ commit_msg_is "commit message"
+'
+
test_expect_success 'using alternate GIT_INDEX_FILE (1)' '
cp .git/index saved-index &&
diff --git a/t/t7500/add-whitespaced-content b/t/t7500/add-whitespaced-content
new file mode 100755
index 000000000..ccf07c61a
--- /dev/null
+++ b/t/t7500/add-whitespaced-content
@@ -0,0 +1,8 @@
+#!/bin/sh
+sed -e 's/|$//' >>"$1" <<\EOF
+
+ |
+commit message |
+
+EOF
+exit 0