From: Junio C Hamano Date: Thu, 22 Jan 2009 00:51:18 +0000 (-0800) Subject: Merge branch 'jf/am-failure-report' X-Git-Tag: v1.6.2-rc0~106 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/07adc43f3a17a34111e17eadef3f6f4eef3eb67a?ds=inline;hp=-c Merge branch 'jf/am-failure-report' * jf/am-failure-report: git-am: re-fix the diag message printing git-am: Make it easier to see which patch failed --- 07adc43f3a17a34111e17eadef3f6f4eef3eb67a diff --combined git-am.sh index 4beb12dcf5,cf3d4a7415..e20dd88392 --- a/git-am.sh +++ b/git-am.sh @@@ -16,7 -16,6 +16,7 @@@ s,signoff add a Signed-off-by lin u,utf8 recode into utf8 (default) k,keep pass -k flag to git-mailinfo whitespace= pass it through git-apply +directory= pass it through git-apply C= pass it through git-apply p= pass it through git-apply resolvemsg= override error message when patch failure occurs @@@ -34,14 -33,6 +34,14 @@@ cd_to_topleve git var GIT_COMMITTER_IDENT >/dev/null || die "You need to set your committer info first" +sq () { + for sqarg + do + printf "%s" "$sqarg" | + sed -e 's/'\''/'\''\\'\'''\''/g' -e 's/.*/ '\''&'\''/' + done +} + stop_here () { echo "$1" >"$dotest/next" exit 1 @@@ -164,10 -155,10 +164,10 @@@ d ;; --resolvemsg) shift; resolvemsg=$1 ;; - --whitespace) - git_apply_opt="$git_apply_opt $1=$2"; shift ;; + --whitespace|--directory) + git_apply_opt="$git_apply_opt $(sq "$1=$2")"; shift ;; -C|-p) - git_apply_opt="$git_apply_opt $1$2"; shift ;; + git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;; --) shift; break ;; *) @@@ -468,7 -459,7 +468,7 @@@ d case "$resolved" in '') - git apply $git_apply_opt --index "$dotest/patch" + eval 'git apply '"$git_apply_opt"' --index "$dotest/patch"' apply_status=$? ;; t) @@@ -510,7 -501,7 +510,7 @@@ fi if test $apply_status != 0 then - echo Patch failed at $msgnum. + printf 'Patch failed at %s %s\n' "$msgnum" "$FIRSTLINE" stop_here_user_resolve $this fi