Skip to content

Commit

Permalink
git-commit: use printf '%s\n' instead of echo on user-supplied strings
Browse files Browse the repository at this point in the history
This fixes the same issue git-am had, which was fixed by Jeff
King in the previous commit.  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>
  • Loading branch information
Junio C Hamano committed May 26, 2007
1 parent 4b7cc26 commit 293623e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions git-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" = -
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 293623e

Please sign in to comment.