Skip to content

Commit

Permalink
am: POSIX portability fix
Browse files Browse the repository at this point in the history
POSIX allows echo without flag to interpret specials such as \n, and we
tried to make things portable by using printf instead where it matters.
Recently added code to "git am" had unprotected "echo", which was caught
by t4014 and Rémi Vanicat.

This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Apr 18, 2008
1 parent 11dc4e7 commit 29df238
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git-am.sh
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ do
SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$dotest/info")"
case "$keep_subject" in -k) SUBJECT="[PATCH] $SUBJECT" ;; esac

(echo "$SUBJECT" ; echo ; cat "$dotest/msg") |
(printf '%s\n\n' "$SUBJECT"; cat "$dotest/msg") |
git stripspace > "$dotest/msg-clean"
;;
esac
Expand Down

0 comments on commit 29df238

Please sign in to comment.