git-commit: use printf '%s\n' instead of echo on user-supplied strings
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>
This commit is contained in:
parent
4b7cc26a74
commit
293623edbc
@ -376,12 +376,12 @@ t,)
|
|||||||
rm -f "$TMP_INDEX"
|
rm -f "$TMP_INDEX"
|
||||||
fi || exit
|
fi || exit
|
||||||
|
|
||||||
echo "$commit_only" |
|
printf '%s\n' "$commit_only" |
|
||||||
GIT_INDEX_FILE="$TMP_INDEX" \
|
GIT_INDEX_FILE="$TMP_INDEX" \
|
||||||
git-update-index --add --remove --stdin &&
|
git-update-index --add --remove --stdin &&
|
||||||
|
|
||||||
save_index &&
|
save_index &&
|
||||||
echo "$commit_only" |
|
printf '%s\n' "$commit_only" |
|
||||||
(
|
(
|
||||||
GIT_INDEX_FILE="$NEXT_INDEX"
|
GIT_INDEX_FILE="$NEXT_INDEX"
|
||||||
export GIT_INDEX_FILE
|
export GIT_INDEX_FILE
|
||||||
@ -432,7 +432,7 @@ fi
|
|||||||
|
|
||||||
if test "$log_message" != ''
|
if test "$log_message" != ''
|
||||||
then
|
then
|
||||||
echo "$log_message"
|
printf '%s\n' "$log_message"
|
||||||
elif test "$logfile" != ""
|
elif test "$logfile" != ""
|
||||||
then
|
then
|
||||||
if test "$logfile" = -
|
if test "$logfile" = -
|
||||||
@ -475,7 +475,7 @@ if test -f "$GIT_DIR/MERGE_HEAD" && test -z "$no_edit"; then
|
|||||||
echo "#"
|
echo "#"
|
||||||
echo "# It looks like you may be committing a MERGE."
|
echo "# It looks like you may be committing a MERGE."
|
||||||
echo "# If this is not correct, please remove the file"
|
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 "# and try again"
|
||||||
echo "#"
|
echo "#"
|
||||||
fi >>"$GIT_DIR"/COMMIT_EDITMSG
|
fi >>"$GIT_DIR"/COMMIT_EDITMSG
|
||||||
|
Loading…
Reference in New Issue
Block a user