From: Junio C Hamano <junkio@cox.net>
To: Jeff King <peff@peff.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Szekeres Istvan <szekeres@iii.hu>,
git@vger.kernel.org
Subject: Re: Bug: git-rebase goofs up \n in commit messages
Date: Fri, 25 May 2007 21:59:43 -0700 [thread overview]
Message-ID: <7vps4onps0.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20070526034236.GA18169@coredump.intra.peff.net> (Jeff King's message of "Fri, 25 May 2007 23:42:36 -0400")
It turns out that git-commit also shares the same problem under
dash.
-- >8 --
git-commit: use printf "%s\n" instead of echo on user-supplied strings
This adds a test to verify the earlier fix to git-am by Jeff
King, and fixes the same issue in git-commit that is exposed by
the new test while at it.
Cleverly enough, this commit's log message is a good test case
at the same time.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
* I suspect we would declare either "war on echo" or "harder push
for builtins" triggered by these.
git-commit.sh | 8 ++++----
t/t4014-format-patch.sh | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/git-commit.sh b/git-commit.sh
index 292cf96..f3f9a35 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -376,12 +376,12 @@ t,)
rm -f "$TMP_INDEX"
fi || exit
- echo "$commit_only" |
+ printf "%s\n" "$commit_only" |
GIT_INDEX_FILE="$TMP_INDEX" \
git-update-index --add --remove --stdin &&
save_index &&
- echo "$commit_only" |
+ printf "%s\n" "$commit_only" |
(
GIT_INDEX_FILE="$NEXT_INDEX"
export GIT_INDEX_FILE
@@ -432,7 +432,7 @@ fi
if test "$log_message" != ''
then
- echo "$log_message"
+ printf "%s\n" "$log_message"
elif test "$logfile" != ""
then
if test "$logfile" = -
@@ -475,7 +475,7 @@ if test -f "$GIT_DIR/MERGE_HEAD" && test -z "$no_edit"; then
echo "#"
echo "# It looks like you may be committing a MERGE."
echo "# If this is not correct, please remove the file"
- echo "# $GIT_DIR/MERGE_HEAD"
+ printf "%s\n" "# $GIT_DIR/MERGE_HEAD"
echo "# and try again"
echo "#"
fi >>"$GIT_DIR"/COMMIT_EDITMSG
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 4795872..42aa9e4 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -16,16 +16,16 @@ test_expect_success setup '
for i in 1 2 5 6 A B C 7 8 9 10; do echo "$i"; done >file &&
git update-index file &&
- git commit -m "Side change #1" &&
+ git commit -m "Side changes #1" &&
for i in D E F; do echo "$i"; done >>file &&
git update-index file &&
- git commit -m "Side change #2" &&
+ git commit -m "Side changes #2" &&
git tag C2 &&
for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >file &&
git update-index file &&
- git commit -m "Side change #3" &&
+ git commit -m "Side changes #3 with \\n backslash-n in it." &&
git checkout master &&
git diff-tree -p C2 | git apply --index &&
next prev parent reply other threads:[~2007-05-26 4:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-25 21:11 Bug: git-rebase goofs up \n in commit messages Szekeres Istvan
2007-05-26 0:40 ` Jeff King
2007-05-26 1:10 ` Herbert Xu
2007-05-26 3:42 ` Jeff King
2007-05-26 3:59 ` Junio C Hamano
2007-05-26 4:59 ` Junio C Hamano [this message]
2007-05-26 6:07 ` Jeff King
2007-05-26 6:13 ` Junio C Hamano
2007-05-26 6:19 ` Herbert Xu
2007-05-26 6:27 ` Jeff King
2007-05-26 7:38 ` Herbert Xu
2007-05-26 7:47 ` Jeff King
2007-05-26 7:47 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vps4onps0.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=peff@peff.net \
--cc=szekeres@iii.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).