From: Jonathan Nieder <jrnieder@gmail.com>
To: Nathan Collins <nathan.collins@gmail.com>
Cc: git <git@vger.kernel.org>
Subject: Re: [BUG?] Patches created with 'diff.noprefix=true' don't 'git apply'.
Date: Wed, 30 Apr 2014 19:40:42 -0700 [thread overview]
Message-ID: <20140501024042.GX9218@google.com> (raw)
In-Reply-To: <CAO8RVvdgN3U5hUEsJjYY9urfeVUDWwHiEur4NQp=H93W37RRnw@mail.gmail.com>
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
next prev parent reply other threads:[~2014-05-01 2:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-01 1:36 [BUG?] Patches created with 'diff.noprefix=true' don't 'git apply' Nathan Collins
2014-05-01 2:40 ` Jonathan Nieder [this message]
2014-05-06 1:33 ` Nathan Collins
2014-05-06 1:59 ` Jonathan Nieder
2014-05-06 18:10 ` Junio C Hamano
2014-05-06 19:36 ` Nathan Collins
2014-05-06 21:12 ` Junio C Hamano
2014-05-07 1:16 ` Nathan Collins
2014-05-07 18:42 ` Junio C Hamano
2014-05-07 23:39 ` Nathan Collins
2014-05-08 4:38 ` Nathan Collins
2014-05-08 4:53 ` Nathan Collins
2014-05-08 16:56 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140501024042.GX9218@google.com \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=nathan.collins@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).