Re: [PATCH] git-apply: fix --3way with binary patch
From: Junio C Hamano <hidden>
Date: 2021-07-28 04:29:10
Jerry Zhang [off-list ref] writes:
quoted hunk
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 &&