am: indicate where a failed patch is to be found

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>

Paul Gortmaker committed Jul 13, 2012 at 11:51 UTC 14bf2d58bc3b202da3ca34cfdf72392889135411
2 files changed +8
Documentation/config.txt
+3
@@ -143,6 +143,9 @@ advice.*::
143 Advice shown when you used linkgit:git-checkout[1] to
144 move to the detach HEAD state, to instruct how to create
145 a local branch after the fact.
146 + amWorkDir::
147 + Advice that shows the location of the patch file when
148 + linkgit:git-am[1] fails to apply it.
149 --
150
151 core.fileMode::
git-am.sh
+5
@@ -834,6 +834,11 @@ did you forget to use 'git add'?"
834 if test $apply_status != 0
835 then
836 eval_gettextln 'Patch failed at $msgnum $FIRSTLINE'
837 + if test "$(git config --bool advice.amworkdir)" != false
838 + then
839 + eval_gettextln "The copy of the patch that failed is found in:
840 + $dotest/patch"
841 + fi
842 stop_here_user_resolve $this
843 fi
844