@matheusbsbs / matheus-bagliano / commits / 293623edbc
Fork 0

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>

Junio C Hamano committed May 25, 2007 at 22:00 UTC 293623edbc9488adbc71c2e0de1100b52cb193ac
1 file changed +4 -4
git-commit.sh
+4 -4
@@ -376,12 +376,12 @@ t,)
376 rm -f "$TMP_INDEX"
377 fi || exit
378
379 - echo "$commit_only" |
379 + printf '%s\n' "$commit_only" |
380 GIT_INDEX_FILE="$TMP_INDEX" \
381 git-update-index --add --remove --stdin &&
382
383 save_index &&
384 - echo "$commit_only" |
384 + printf '%s\n' "$commit_only" |
385 (
386 GIT_INDEX_FILE="$NEXT_INDEX"
387 export GIT_INDEX_FILE
@@ -432,7 +432,7 @@ fi
432
433 if test "$log_message" != ''
434 then
435 - echo "$log_message"
435 + printf '%s\n' "$log_message"
436 elif test "$logfile" != ""
437 then
438 if test "$logfile" = -
@@ -475,7 +475,7 @@ if test -f "$GIT_DIR/MERGE_HEAD" && test -z "$no_edit"; then
475 echo "#"
476 echo "# It looks like you may be committing a MERGE."
477 echo "# If this is not correct, please remove the file"
478 - echo "# $GIT_DIR/MERGE_HEAD"
478 + printf '%s\n' "# $GIT_DIR/MERGE_HEAD"
479 echo "# and try again"
480 echo "#"
481 fi >>"$GIT_DIR"/COMMIT_EDITMSG