am: indicate where a failed patch is to be found
authorPaul Gortmaker <paul.gortmaker@windriver.com>
Fri, 13 Jul 2012 15:51:30 +0000 (11:51 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 Jul 2012 23:02:48 +0000 (16:02 -0700)
If "git am" fails to apply something, the end user may need to know
where to find the patch that failed to apply, so that the user can
do other things (e.g. trying "GNU patch" on it, running "diffstat"
to see what it tried to change, etc.)  The input to "am" may have
contained more than one patch, or the message may have been MIME
encoded, and knowing what the user fed to "am" does not help very
much for this purpose.

Also introduce advice.amworkdir configuration to allow people who
learned where to look to squelch this message.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config.txt
git-am.sh

index 0e1168c06661448d0757ceb3a7c2155a3dd42809..b1f0a75c6fe4404dc511ee1410ba5f948270a0b2 100644 (file)
@@ -143,6 +143,9 @@ advice.*::
                Advice shown when you used linkgit:git-checkout[1] to
                move to the detach HEAD state, to instruct how to create
                a local branch after the fact.
+       amWorkDir::
+               Advice that shows the location of the patch file when
+               linkgit:git-am[1] fails to apply it.
 --
 
 core.fileMode::
index cb833e217ae90ebfe2f5ed1710d4372906bdfe3e..f1ae932fa753c7c08769b96420d04fed8ed58804 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -834,6 +834,11 @@ did you forget to use 'git add'?"
        if test $apply_status != 0
        then
                eval_gettextln 'Patch failed at $msgnum $FIRSTLINE'
+               if test "$(git config --bool advice.amworkdir)" != false
+               then
+                       eval_gettextln "The copy of the patch that failed is found in:
+   $dotest/patch"
+               fi
                stop_here_user_resolve $this
        fi