Thread (1 message) 1 message, 1 author, 2016-06-15

Re: bug: transform a binary file into a symlink in one commit => invalid binary patch

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:02

Jeff King [off-list ref] writes:
On Fri, Jan 23, 2009 at 01:25:30PM +0100, Pixel wrote:
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help