git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "lilinchao@oschina.cn" <lilinchao@oschina.cn>
To: git <git@vger.kernel.org>
Cc: "jerry@skydio.com" <jerry@skydio.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: git apply --3way behaves abnormally when the patch contains binary changes.
Date: Tue, 27 Jul 2021 22:07:32 +0800	[thread overview]
Message-ID: <fdfd283aeee311ebbfb50024e87935e7@oschina.cn> (raw)

I see the latest change about `git apply --3way` is 923cd87, but it doesn't seem to have been fully tested
(in t4108-apply-threeway.sh).
On latest Git version 2.32.0, consider test case below:
"
test_expect_success 'apply binary file patch with --3way' '
        # 1. on new branch, commit binary file 
        git checkout -b left &&
        cat "$TEST_DIRECTORY"/test-binary-1.png >bin.png &&
        git add bin.png &&
        git commit -m "add binary file" &&

        # 2. based on left_bin branch, make any change, and commit
        git checkout -b right &&
        cat bin.png bin.png > bin.png &&
        git add bin.png &&
        git commit -m "update binary file" &&

        # 3. make patch
        git diff --binary left..right >bin.diff &&
        # apply --3way, and it will fail
        test_must_fail git apply --index --3way bin.diff
'
"

But  "git apply --index --3way bin.diff" will not faill on Git version 2.31.0.



             reply	other threads:[~2021-07-27 14:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 14:07 lilinchao [this message]
2021-07-27 22:44 ` git apply --3way behaves abnormally when the patch contains binary changes Jerry Zhang
2021-07-28  1:08   ` Junio C Hamano
2021-07-28  1:37     ` Jerry Zhang
     [not found]   ` <4eb90a4eef4011ebab68d4ae5272fd1139378@pobox.com>
2021-07-28  4:45     ` lilinchao

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=fdfd283aeee311ebbfb50024e87935e7@oschina.cn \
    --to=lilinchao@oschina.cn \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jerry@skydio.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).