Skip to content

Commit

Permalink
am: indicate where a failed patch is to be found
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Gortmaker authored and Junio C Hamano committed Jul 13, 2012
1 parent d0f1ea6 commit 14bf2d5
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
@@ -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::
5 changes: 5 additions & 0 deletions git-am.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 14bf2d5

Please sign in to comment.