From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Pixel <pixel@mandriva.com>, git@vger.kernel.org
Subject: Re: bug: transform a binary file into a symlink in one commit => invalid binary patch
Date: Sun, 25 Jan 2009 23:37:21 -0800 [thread overview]
Message-ID: <7vy6wy8qmm.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20090126003556.GA19368@coredump.intra.peff.net> (Jeff King's message of "Sun, 25 Jan 2009 19:35:56 -0500")
Jeff King <peff@peff.net> writes:
> On Fri, Jan 23, 2009 at 01:25:30PM +0100, Pixel wrote:
>
>> i hit a bug (git 1.6.1): when you transform a binary file into a
>> symlink in one commit, the binary patch can't be used in "git apply".
>> Is it a known issue?
>
> Not that I know of.
>
> Below is a patch against the test suite that fairly neatly displays the
> problem. I didn't get a chance to look into actually fixing it, though
> (I'm not even sure the problem is in apply, and not in the generated
> patch).
The generated diff is wrong.
A filepair that changes type must be split into deletion followed by
creation, which means the "index" line should say 0{40} on the right hand
side for the first half and then 0{40} on the left hand side for the
second half. The patch generated by this step:
> +test_expect_success 'create patch' '
> + git diff-tree --binary HEAD^ HEAD >patch
> +'
However says the blob contents change from "\0" to "file" on both.
This is because diff.c::run_diff() computes "index" only once and reuses
it for both halves.
next prev parent reply other threads:[~2009-01-26 7:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-23 12:25 bug: transform a binary file into a symlink in one commit => invalid binary patch Pixel
2009-01-23 13:13 ` Michael J Gruber
2009-01-26 0:35 ` Jeff King
2009-01-26 7:37 ` Junio C Hamano [this message]
2009-01-26 8:33 ` [PATCH] diff.c: output correct index lines for a split diff Junio C Hamano
2009-01-26 9:07 ` Jeff King
2009-01-28 21:32 ` 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vy6wy8qmm.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=pixel@mandriva.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).