Merge branch 'jf/am-failure-report'
authorJunio C Hamano <gitster@pobox.com>
Thu, 22 Jan 2009 00:51:18 +0000 (16:51 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Jan 2009 00:51:18 +0000 (16:51 -0800)
* jf/am-failure-report:
git-am: re-fix the diag message printing
git-am: Make it easier to see which patch failed

1  2 
git-am.sh
diff --combined git-am.sh
index 4beb12dcf5e94c0bc0decf8720f4a622b8b2d325,cf3d4a7415903a8cba99812ec4a264846165b1c2..e20dd88392c892a6b88e29501e0b13be8a73aaf9
+++ 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
                ;;
        --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)
        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