git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Pixel <pixel@mandriva.com>
Cc: 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 19:35:56 -0500	[thread overview]
Message-ID: <20090126003556.GA19368@coredump.intra.peff.net> (raw)
In-Reply-To: <lyhc3q9pl1.fsf@leia.mandriva.com>

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).

---
diff --git a/t/t4130-apply-symlink-binary.sh b/t/t4130-apply-symlink-binary.sh
new file mode 100755
index 0000000..0ee2ba1
--- /dev/null
+++ b/t/t4130-apply-symlink-binary.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+test_description='apply handles binary to symlink conversion'
+. ./test-lib.sh
+
+test_expect_success 'create commit with binary' '
+	echo content >file && git add file &&
+	printf "\0" > binary && git add binary &&
+	git commit -m one
+'
+
+test_expect_success 'convert binary to symlink' '
+	rm binary &&
+	ln -s file binary &&
+	git add binary &&
+	git commit -m two
+'
+
+test_expect_success 'create patch' '
+	git diff-tree --binary HEAD^ HEAD >patch
+'
+
+test_expect_success 'apply patch' '
+	git reset --hard HEAD^ &&
+	git apply patch &&
+	test -h binary &&
+	test_cmp binary file
+'
+
+test_done

  parent reply	other threads:[~2009-01-26  0:37 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 [this message]
2009-01-26  7:37   ` Junio C Hamano
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090126003556.GA19368@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --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.
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).