Subject: Re: [BUG?] Patches created with 'diff.noprefix=true' don't 'git apply'.

From: Junio C Hamano <[email-masked]>
Date: Tue, 06 May 2014 11:10:13 -0700

Nathan Collins <[email-masked]> writes:

> Hmmm. Maybe a warning that the patch is expected to be in '-p1'
> format, and that setting 'diff.noprefix=true' makes some commands
> generate '-p0' patches?

"some"?  Do you have exceptions in mind?

> But I worry this would just confuse / distract
> the people that don't have 'diff.noprefix=true' set,

Probably.  But that would suggest that the place to improve the doc
is for diff.noprefix configuration variable, no?

> Better I think would be for 'git apply' to be
> smarter, as you suggest below.

As it is a plumbing command behind "add -p", "am", and friends, I
would hate to see "git apply" pretend to be smarter than its users.
When the user tells it to use -p0, it shouldn't guess, and when the
user tells it to use -p1 by not giving any -p$n, it shouldn't guess.

As long as we make it clear "git apply" without any explicit -p$n
means the user is telling it to do -p1 in its documentation, I think
it would be fine.

>> I personally think setting diff.noprefix is not very sane (it also
>> breaks "patch -p1"), and I suppose I should have been louder about
>> that when it was introduced.

I share the same feeling ;-)  But the boat has sailed, so the best
we could do is to warn in its doc (i.e. where diff.noprefix is
described) about its pitfalls.