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

Re: [PATCH] git-apply: fix --3way with binary patch

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 28, 2021, 04:29 UTC
Message-ID
<xmqqim0vawof.fsf@gitster.g>
In-Reply-To
<20210728024434.20230-1-jerry@skydio.com>
Jerry Zhang <jerry@skydio.com> writes:
Show 11 quoted lines
> diff --git a/t/t4108-apply-threeway.sh b/t/t4108-apply-threeway.sh
> index 65147efdea..d32748f899 100755
> --- a/t/t4108-apply-threeway.sh
> +++ b/t/t4108-apply-threeway.sh
> @@ -230,4 +230,49 @@ test_expect_success 'apply with --3way --cached and conflicts' '
>  	test_cmp expect.diff actual.diff
>  '
>  
> +test_expect_success 'apply binary file patch' '
> +	git reset --hard main &&
> +	cp $TEST_DIRECTORY/test-binary-1.png bin.png &&

Is it safe to use $TEST_DIRECTORY without quoting? I doubt it, as it is $(pwd) of whereever the testing user extracted our source tarball.

In other words, you'd need this.
diff --git w/t/t4108-apply-threeway.sh c/t/t4108-apply-threeway.sh
index d32748f899..cc3aa3314a 100755
--- w/t/t4108-apply-threeway.sh
+++ c/t/t4108-apply-threeway.sh
@@ -232,11 +232,11 @@ test_expect_success 'apply with --3way --cached and conflicts' '
 
 test_expect_success 'apply binary file patch' '
 	git reset --hard main &&
-	cp $TEST_DIRECTORY/test-binary-1.png bin.png &&
+	cp "$TEST_DIRECTORY/test-binary-1.png" bin.png &&
 	git add bin.png &&
 	git commit -m "add binary file" &&
 
-	cp $TEST_DIRECTORY/test-binary-2.png bin.png &&
+	cp "$TEST_DIRECTORY/test-binary-2.png" bin.png &&
 
 	git diff --binary >bin.diff &&
 	git reset --hard &&
@@ -247,11 +247,11 @@ test_expect_success 'apply binary file patch' '
 
 test_expect_success 'apply binary file patch with 3way' '
 	git reset --hard main &&
-	cp $TEST_DIRECTORY/test-binary-1.png bin.png &&
+	cp "$TEST_DIRECTORY/test-binary-1.png" bin.png &&
 	git add bin.png &&
 	git commit -m "add binary file" &&
 
-	cp $TEST_DIRECTORY/test-binary-2.png bin.png &&
+	cp "$TEST_DIRECTORY/test-binary-2.png" bin.png &&
 
 	git diff --binary >bin.diff &&
 	git reset --hard &&
@@ -262,11 +262,11 @@ test_expect_success 'apply binary file patch with 3way' '
 
 test_expect_success 'apply full-index patch with 3way' '
 	git reset --hard main &&
-	cp $TEST_DIRECTORY/test-binary-1.png bin.png &&
+	cp "$TEST_DIRECTORY/test-binary-1.png" bin.png &&
 	git add bin.png &&
 	git commit -m "add binary file" &&
 
-	cp $TEST_DIRECTORY/test-binary-2.png bin.png &&
+	cp "$TEST_DIRECTORY/test-binary-2.png" bin.png &&
 
 	git diff --full-index >bin.diff &&
 	git reset --hard &&
Previous: Jerry ZhangNext: Junio C Hamano
Message 2 of 16 in “git-apply: fix --3way with binary patch”
  1. git-apply: fix --3way with binary patchJerry Zhang, Jul 28, 2021
  2. Junio C HamanoJul 28, 2021
  3. Junio C HamanoJul 28, 2021
  4. ll-merge: teach ll_binary_merge() a trivial three-way mergeJunio C Hamano, Jul 28, 2021
  5. Elijah NewrenJul 28, 2021
  6. Junio C HamanoJul 29, 2021
  7. apply: resolve trivial merge without hitting ll-merge with "--3way"Junio C Hamano, Sep 5, 2021
  8. Elijah NewrenSep 6, 2021
  9. Ævar Arnfjörð BjarmasonSep 6, 2021
  10. Junio C HamanoSep 7, 2021
  11. Junio C HamanoSep 7, 2021
  12. Jerry ZhangJul 28, 2021
  13. Jerry ZhangJul 28, 2021
  14. Junio C HamanoJul 28, 2021
  15. Jerry ZhangJul 28, 2021
  16. Junio C HamanoJul 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.