Subject: Re: Better suggestions when git-am(1) fails

From: Alejandro Colomar <[email-masked]>
Date: Thu, 9 Mar 2023 11:58:00 +0100

Hi Jeff,

On 3/9/23 07:06, Jeff King wrote:
> On Wed, Mar 08, 2023 at 10:17:11PM -0500, Jeff King wrote:
> 
>> On Wed, Mar 08, 2023 at 09:15:53PM +0100, Alejandro Colomar wrote:
>>
>>> I had the following error already a few times, when some contributors,
>>> for some reason unknown to me, remove the leading path components from
>>> the patch.
>>
>> The reason is probably that they have set diff.noprefix in their config,
>> and git-format-patch respects that. Which is arguably a bug. There's a
>> little discussion in this message, along with references to some
>> previous discussions:
>>
>>   https://lore.kernel.org/git/[email-masked]/
> 
> So here's a patch series which I think should help with the sending
> side. Most of it is just filling in gaps in the code and tests for
> current features. Patch 4 is the actual change. Patch 5 adds an
> equivalent option just for format-patch. I'm not convinced anybody
> really wants it (which is why I split it out), but it's probably worth
> doing just in case.

Thanks for the rapid patch set :)

> 
>   [1/5]: diff: factor out src/dst prefix setup
>   [2/5]: t4013: add tests for diff prefix options
>   [3/5]: diff: add --default-prefix option
>   [4/5]: format-patch: do not respect diff.noprefix
>   [5/5]: format-patch: add format.noprefix option

1, 3, and 4 LGTM.  I'm not used to your tests, so can't really check
what 2 does without further reading, and I'm not sure 5 is useful.

BTW, I'll probably report a few more things I don't like from
git-am(1)'s error reports, whenever I find them again.  ;)

Cheers,

Alex

> 
>  Documentation/config/format.txt |  7 ++++++
>  Documentation/diff-options.txt  |  5 ++++
>  builtin/log.c                   | 17 +++++++++++++
>  diff.c                          | 33 ++++++++++++++++++++++----
>  diff.h                          |  2 ++
>  t/t4013-diff-various.sh         | 42 +++++++++++++++++++++++++++++++++
>  t/t4014-format-patch.sh         | 16 +++++++++++++
>  7 files changed, 117 insertions(+), 5 deletions(-)
> 
> -Peff

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5