From: Jeff King <peff@peff.net>
To: Imre Deak <imre.deak@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>, git@vger.kernel.org
Subject: Re: git apply: git diff header lacks filename information for git diff --no-index patch
Date: Sat, 4 Oct 2008 00:17:14 -0400 [thread overview]
Message-ID: <20081004041714.GA12413@coredump.intra.peff.net> (raw)
In-Reply-To: <500f3d130810021127j570bb540p901f6a73f58a6cb1@mail.gmail.com>
On Thu, Oct 02, 2008 at 09:27:36PM +0300, Imre Deak wrote:
> $ git apply patch
> fatal: git diff header lacks filename information (line 4)
> $ cat patch
> diff --git a/dev/null b/a
> new file mode 100644
> index 0000000000000000000000000000000000000000..1f2a4f5ef3df7f7456d91c961da36fc58904f2f1
> GIT binary patch
Hmm. The problem is that "git apply" doesn't accept that "a/dev/null"
and "b/a" are the same, so it rejects them as a name. I guess on a text
patch, we would just pull that information from the "---" and "+++"
lines, so we don't care that it's not on the diff commandline.
However, a _non_ --no-index patch doesn't produce the same output. It
will actually produce the line:
diff --git a/a b/a
even if it is a creation patch. So I'm not sure which piece of code is
at fault. Either:
1. git apply is right to reject, and "git diff --no-index" should be
putting the actual filename on the commandline of a binary patch
instead of /dev/null, even if it is a creation patch.
or
2. git apply should accept this construct. Perhaps we should relax the
"both names must be the same" rule if one of the names is /dev/null
(and we would take the other)?
Linus, the "both names must be the same" code in git_header_name blames
to you (5041aa70). Thoughts on number 2?
-Peff
next prev parent reply other threads:[~2008-10-04 4:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-02 18:27 git apply: git diff header lacks filename information for git diff --no-index patch Imre Deak
2008-10-04 4:17 ` Jeff King [this message]
2008-10-04 8:28 ` Jakub Narebski
2008-10-05 19:19 ` Jeff King
2008-10-04 16:54 ` Linus Torvalds
2008-10-04 17:08 ` Linus Torvalds
2008-10-04 17:48 ` Linus Torvalds
2008-10-05 19:21 ` Jeff King
2008-10-05 19:17 ` Jeff King
2008-10-05 19:24 ` Jeff King
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=20081004041714.GA12413@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=imre.deak@gmail.com \
--cc=torvalds@linux-foundation.org \
/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).