Skip to content

Commit 14bf2d5

Browse files
Paul Gortmakergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d0f1ea6 commit 14bf2d5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Documentation/config.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ advice.*::
143143
Advice shown when you used linkgit:git-checkout[1] to
144144
move to the detach HEAD state, to instruct how to create
145145
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.
146149
--
147150

148151
core.fileMode::

git-am.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,11 @@ did you forget to use 'git add'?"
834834
if test $apply_status != 0
835835
then
836836
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
837842
stop_here_user_resolve $this
838843
fi
839844

0 commit comments

Comments
 (0)