Re: [PATCH v2] git-am: indicate where a failed patch is to be found.

2012-07-13 Thread Junio C Hamano
Paul Gortmaker  writes:

> I'm fine with the changes you've proposed below,...

Here is what I committed for today's integration run.  Will be
pushed out on 'pu'.

Thanks.

-- >8 --
From: Paul Gortmaker 
Date: Fri, 13 Jul 2012 11:51:30 -0400
Subject: [PATCH] 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 
Signed-off-by: Junio C Hamano 
---
 Documentation/config.txt | 3 +++
 git-am.sh| 5 +
 2 files changed, 8 insertions(+)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 0e1168c..b1f0a75 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -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::
diff --git a/git-am.sh b/git-am.sh
index cb833e2..f1ae932 100755
--- 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
 
-- 
1.7.11.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] git-am: indicate where a failed patch is to be found.

2012-07-13 Thread Paul Gortmaker
On 12-07-13 03:58 PM, Junio C Hamano wrote:
> Paul Gortmaker  writes:
> 
>> If git am fails to apply something, the end user may need
>> to know where to find the patch.  This is normally known for
>> a single patch, but if the user is processing a mbox with
>> many patches, they may not have a single broken out patch
>> handy.  So, provide a helpful hint as to where they can
>> find the patch to do some sort of manual fixup, if we
>> are processing a mbox with more than one patch in it.
> 
> I would rather see this done even for a single patch mbox.  The

OK, I got the opposite impression from your prev. mail when
you mentioned that I hadn't limited the message output at all.

I'm fine with the changes you've proposed below, and can squash that
into a v3 and resend again.

Paul.
--

> patch that was fed to "git apply" by "git am" and failed to apply is
> that one, not the one in the mbox you gave "git am".  The latter may
> be ungrokkable with GNU patch or "git apply", if the original was
> sent in Quoted-Printable and such MIME funnies, which is the whole
> point of having a separate file there for "git am", instead of
> feeding the original.
> 
> I am not sure if we should limit $patch_format to mbox, but I think
> showing this unconditionally regardless of mbox/stgit/hg will teach
> the user only one location to remember, so perhaps like this?
> 
>  Documentation/config.txt | 3 +++
>  git-am.sh| 4 ++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 0e1168c..b1f0a75 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -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::
> diff --git a/git-am.sh b/git-am.sh
> index dc48f87..f1ae932 100755
> --- a/git-am.sh
> +++ b/git-am.sh
> @@ -834,9 +834,9 @@ did you forget to use 'git add'?"
>   if test $apply_status != 0
>   then
>   eval_gettextln 'Patch failed at $msgnum $FIRSTLINE'
> - if test $patch_format = mbox && test "$last" -ne "1"
> + if test "$(git config --bool advice.amworkdir)" != false
>   then
> - eval_gettextln "You can find the copy of the patch that 
> failed here:
> + eval_gettextln "The copy of the patch that failed is 
> found in:
> $dotest/patch"
>   fi
>   stop_here_user_resolve $this
> 

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] git-am: indicate where a failed patch is to be found.

2012-07-13 Thread Junio C Hamano
Paul Gortmaker  writes:

> If git am fails to apply something, the end user may need
> to know where to find the patch.  This is normally known for
> a single patch, but if the user is processing a mbox with
> many patches, they may not have a single broken out patch
> handy.  So, provide a helpful hint as to where they can
> find the patch to do some sort of manual fixup, if we
> are processing a mbox with more than one patch in it.

I would rather see this done even for a single patch mbox.  The
patch that was fed to "git apply" by "git am" and failed to apply is
that one, not the one in the mbox you gave "git am".  The latter may
be ungrokkable with GNU patch or "git apply", if the original was
sent in Quoted-Printable and such MIME funnies, which is the whole
point of having a separate file there for "git am", instead of
feeding the original.

I am not sure if we should limit $patch_format to mbox, but I think
showing this unconditionally regardless of mbox/stgit/hg will teach
the user only one location to remember, so perhaps like this?

 Documentation/config.txt | 3 +++
 git-am.sh| 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 0e1168c..b1f0a75 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -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::
diff --git a/git-am.sh b/git-am.sh
index dc48f87..f1ae932 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -834,9 +834,9 @@ did you forget to use 'git add'?"
if test $apply_status != 0
then
eval_gettextln 'Patch failed at $msgnum $FIRSTLINE'
-   if test $patch_format = mbox && test "$last" -ne "1"
+   if test "$(git config --bool advice.amworkdir)" != false
then
-   eval_gettextln "You can find the copy of the patch that 
failed here:
+   eval_gettextln "The copy of the patch that failed is 
found in:
$dotest/patch"
fi
stop_here_user_resolve $this

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] git-am: indicate where a failed patch is to be found.

2012-07-13 Thread Paul Gortmaker
If git am fails to apply something, the end user may need
to know where to find the patch.  This is normally known for
a single patch, but if the user is processing a mbox with
many patches, they may not have a single broken out patch
handy.  So, provide a helpful hint as to where they can
find the patch to do some sort of manual fixup, if we
are processing a mbox with more than one patch in it.

Signed-off-by: Paul Gortmaker 
---
[v2: drop text suggesting what to do with failed patch; only
 emit the help text if we are processing mbox with multi patches]

 git-am.sh |5 +
 1 file changed, 5 insertions(+)

diff --git a/git-am.sh b/git-am.sh
index f8b7a0c..20b3b73 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -855,6 +855,11 @@ did you forget to use 'git add'?"
if test $apply_status != 0
then
eval_gettextln 'Patch failed at $msgnum $FIRSTLINE'
+   if test $patch_format = mbox && test "$last" -ne "1"
+   then
+   eval_gettextln "You can find the copy of the patch that 
failed here:
+   $dotest/patch"
+   fi
stop_here_user_resolve $this
fi
 
-- 
1.7.9.7

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html