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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Nathan Collins wrote:

> Patches created with 'diff.noprefix=true' don't 'git apply' without
> specifying '-p0'.
>
> I'm not sure this is a bug -- the 'man git-apply' just says "Reads the
> supplied diff output (i.e. "a patch") and applies it to files" -- but
> I would expect patches I create locally to apply cleanly locally.

Sounds like a documentation bug, at least.  Any ideas for clearer
wording?

>                                                                   In
> real life the 'diff.noprefix=true' is in my ~/.gitconfig, so this was
> pretty confusing.

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.

Can you say more about the workflow you use that requires
diff.noprefix?  Maybe we can make other changes to improve it, too.

At first glance I don't suspect making diff.noprefix imply -p0 for
"git am" would be great, since that would generate the the opposite
problem when applying patches from the outside world.  But maybe we
need better autodetection and maybe noprefix is a good signal about
when to use it.

Another complication is that unlike 'git diff', 'git apply' is
plumbing that is meant to be useful and reliable for scripts.  And
unlike most plumbing, there is no higher-level command with similar
functionality for which we can experiment more freely with the UI.
Adding a new command to fix that might be a good direction toward
handling noprefix patches better.

[...]
> git show | git apply --reverse

The following which only uses plumbing commands should work:

	git diff-tree -p HEAD^! |
	git apply --reverse

Thanks for some food for thought,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]