git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git apply --3way behaves abnormally when the patch contains binary changes.

From
Llilinchao@oschina.cn <lilinchao@oschina.cn>
Date
Jul 27, 2021, 14:07 UTC
Message-ID
<fdfd283aeee311ebbfb50024e87935e7@oschina.cn>
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.
Next: Jerry Zhang
Message 1 of 5 in “git apply --3way behaves abnormally when the patch contains binary changes.”
  1. lilinchao@oschina.cnJul 27, 2021
  2. Jerry ZhangJul 27, 2021
  3. Junio C HamanoJul 28, 2021
  4. Jerry ZhangJul 28, 2021
  5. lilinchao@oschina.cnJul 28, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.