{"thread":{"id":"66305","subject":"[PATCH v2 3/3] Update t4010 to use modern style.","startedAt":"2026-09-10T17:07:55Z","lastAt":"2026-09-10T17:56:25Z","messageCount":5,"participants":["Mark C. Chu-Carroll via B4 Relay","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"552471","messageId":"20260910-modernize-t4001-v2-0-ac53e9f5d717@fastmail.com","threadId":"66305","inReplyTo":"20260908-modernize-t4001-v1-0-cab3933a173f@fastmail.com","subject":"[PATCH v2 0/3] Update t40* tests to use modern style.","fromName":"Mark C. Chu-Carroll via B4 Relay","fromEmail":"devnull+markchucarroll.fastmail.com@kernel.org","sentAt":"2026-09-10T17:07:32Z","receivedAt":"2026-09-10T17:07:53Z","isPatch":true,"body":"To: git@vger.kernel.org\nSigned-off-by: Mark C. Chu-Carroll <markchucarroll@fastmail.com>\n\nChanges in v2:\n- Merged setups into main test bodies.\n- Removed unnecessary echos.\n- Cleaned up here-docs.\n- Updated names to modern style.\n\n- Link to v1: https://patch.msgid.link/20260908-modernize-t4001-v1-0-cab3933a173f@fastmail.com\n\n---\nMark C. Chu-Carroll (3):\n      Update t4001 to use modern syntax.\n      Update t4009 to use modern style.\n      Update t4010 to use modern style.\n\n t/t4001-diff-rename.sh   |  97 ++++++++++++++++-------------------\n t/t4009-diff-rename-4.sh | 131 +++++++++++++++++++++++------------------------\n t/t4010-diff-pathspec.sh |  88 +++++++++++--------------------\n 3 files changed, 137 insertions(+), 179 deletions(-)\n\nRange-diff versus v1:\n\n1:  d55c790b60 < -:  ---------- Update t4001 to use modern syntax.\n2:  0fec9484a6 < -:  ---------- Update t4009 to use modern style.\n3:  4dbb726578 < -:  ---------- Update t4010 to use modern style.\n-:  ---------- > 1:  d560c2a155 Update t4001 to use modern syntax.\n-:  ---------- > 2:  a52bf71409 Update t4009 to use modern style.\n-:  ---------- > 3:  553fe00594 Update t4010 to use modern style.\n\n---\nbase-commit: 5c40f33ab5825c90dd32cfb08198de2beedc6ed1\nchange-id: 20260908-modernize-t4001-fb43302caaf9\n\n\n"},{"id":"552473","messageId":"20260910-modernize-t4001-v2-1-ac53e9f5d717@fastmail.com","threadId":"66305","inReplyTo":"20260910-modernize-t4001-v2-0-ac53e9f5d717@fastmail.com","subject":"[PATCH v2 1/3] Update t4001 to use modern syntax.","fromName":"Mark C. Chu-Carroll via B4 Relay","fromEmail":"devnull+markchucarroll.fastmail.com@kernel.org","sentAt":"2026-09-10T17:07:33Z","receivedAt":"2026-09-10T17:07:53Z","isPatch":true,"body":"From: \"Mark C. Chu-Carroll\" <markchucarroll@fastmail.com>\n\n---\n t/t4001-diff-rename.sh   | 97 +++++++++++++++++++++---------------------------\n t/t4009-diff-rename-4.sh | 54 +++++++++++++--------------\n 2 files changed, 70 insertions(+), 81 deletions(-)\n\ndiff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh\nindex ad474100af..c27bd9d781 100755\n--- a/t/t4001-diff-rename.sh\n+++ b/t/t4001-diff-rename.sh\n@@ -8,7 +8,7 @@ test_description='Test rename detection in diff engine.'\n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/lib-diff.sh\n \n-test_expect_success 'setup' '\n+initial_setup () {\n \tcat >path0 <<-\\EOF &&\n \tLine 1\n \tLine 2\n@@ -26,7 +26,7 @@ test_expect_success 'setup' '\n \tLine 14\n \tLine 15\n \tEOF\n-\tcat >expected <<-\\EOF &&\n+\tcat >expect <<-\\EOF &&\n \tdiff --git a/path0 b/path1\n \trename from path0\n \trename to path1\n@@ -42,7 +42,7 @@ test_expect_success 'setup' '\n \t Line 13\n \t Line 14\n \tEOF\n-\tcat >no-rename <<-\\EOF\n+\tcat >expect-no-rename <<-\\EOF\n \tdiff --git a/path0 b/path0\n \tdeleted file mode 100644\n \tindex fdbec44..0000000\n@@ -86,47 +86,36 @@ test_expect_success 'setup' '\n \t+Line 14\n \t+Line 15\n \tEOF\n-'\n-\n-test_expect_success \\\n-    'update-index --add a file.' \\\n-    'git update-index --add path0'\n-\n-test_expect_success \\\n-    'write that tree.' \\\n-    'tree=$(git write-tree) && echo $tree'\n-\n-sed -e 's/line/Line/' <path0 >path1\n-rm -f path0\n-test_expect_success \\\n-    'renamed and edited the file.' \\\n-    'git update-index --add --remove path0 path1'\n+    update-index --add a file.\n+    git update-index --add path0\n+}\n \n-test_expect_success \\\n-    'git diff-index -p -M after rename and editing.' \\\n-    'git diff-index -p -M $tree >current'\n-\n-\n-test_expect_success \\\n-    'validate the output.' \\\n-    'compare_diff_patch current expected'\n+test_expect_success 'Diff shows path0 renamed to path1 with edit.' '\n+\tinitial_setup &&\n+\ttree=$(git write-tree) &&\n+\tsed -e \"s/line/Line/\" <path0 >path1 &&\n+\trm -f path0 &&\n+\tgit update-index --add --remove path0 path1 &&\n+\tgit diff-index -p -M $tree >actual &&\n+\tcompare_diff_patch actual expect\n+'\n \n-test_expect_success 'test diff.renames=true' '\n-\tgit -c diff.renames=true diff --cached $tree >current &&\n-\tcompare_diff_patch current expected\n+test_expect_success 'With diff.renames=true, patch includes rename of path0 to path1' '\n+\tgit -c diff.renames=true diff --cached $tree >actual &&\n+\tcompare_diff_patch actual expect\n '\n \n-test_expect_success 'test diff.renames=false' '\n-\tgit -c diff.renames=false diff --cached $tree >current &&\n-\tcompare_diff_patch current no-rename\n+test_expect_success 'With diff.renames=false, patch does not include rename' '\n+\tgit -c diff.renames=false diff --cached $tree >actual &&\n+\tcompare_diff_patch actual expect-no-rename\n '\n \n-test_expect_success 'test diff.renames unset' '\n-\tgit diff --cached $tree >current &&\n-\tcompare_diff_patch current expected\n+test_expect_success 'With no setting for diff.renames, patch includes rename' '\n+\tgit diff --cached $tree >actual &&\n+\tcompare_diff_patch actual expect\n '\n \n-test_expect_success 'favour same basenames over different ones' '\n+test_expect_success 'Diff rename favours same basenames over different ones' '\n \tcp path1 another-path &&\n \tgit add another-path &&\n \tgit commit -m 1 &&\n@@ -137,25 +126,25 @@ test_expect_success 'favour same basenames over different ones' '\n \ttest_grep \"renamed: .*path1 -> subdir/path1\" out\n '\n \n-test_expect_success 'test diff.renames=true for git status' '\n+test_expect_success 'With diff.renames=true, git status includes rename' '\n \tgit -c diff.renames=true status >out &&\n \ttest_grep \"renamed: .*path1 -> subdir/path1\" out\n '\n \n-test_expect_success 'test diff.renames=false for git status' '\n+test_expect_success 'With diff.renames=false, git status shows delete/add' '\n \tgit -c diff.renames=false status >out &&\n \ttest_grep ! \"renamed: .*path1 -> subdir/path1\" out &&\n \ttest_grep \"new file: .*subdir/path1\" out &&\n \ttest_grep \"deleted: .*[^/]path1\" out\n '\n \n-test_expect_success 'favour same basenames even with minor differences' '\n+test_expect_success 'rename logic favours same basenames even with minor differences' '\n \tgit show HEAD:path1 | sed \"s/15/16/\" > subdir/path1 &&\n \tgit status >out &&\n \ttest_grep \"renamed: .*path1 -> subdir/path1\" out\n '\n \n-test_expect_success 'two files with same basename and same content' '\n+test_expect_success 'Favors common path segments for files with the same basename and content' '\n \tgit reset --hard &&\n \tmkdir -p dir/A dir/B &&\n \tcp path1 dir/A/file &&\n@@ -167,7 +156,7 @@ test_expect_success 'two files with same basename and same content' '\n \ttest_grep \"renamed: .*dir/A/file -> other-dir/A/file\" out\n '\n \n-test_expect_success 'setup for many rename source candidates' '\n+test_expect_success 'rename with many candidates' '\n \tgit reset --hard &&\n \tfor i in 0 1 2 3 4 5 6 7 8 9;\n \tdo\n@@ -177,14 +166,14 @@ test_expect_success 'setup for many rename source candidates' '\n \t\tdone\n \tdone &&\n \tgit add \"path??\" &&\n-\ttest_tick &&\n+\ttest_tick  &&\n \tgit commit -m \"hundred\" &&\n \t(cat path1 && echo new) >new-path &&\n \techo old >>path1 &&\n \tgit add new-path path1 &&\n \tgit diff -l 4 -C -C --cached --name-status >actual 2>actual.err &&\n \tsed -e \"s/^\\([CM]\\)[0-9]*\t/\\1\t/\" actual >actual.munged &&\n-\tcat >expect <<-EOF &&\n+\tcat >expect <<-\\EOF &&\n \tC\tpath1\tnew-path\n \tM\tpath1\n \tEOF\n@@ -192,7 +181,7 @@ test_expect_success 'setup for many rename source candidates' '\n \ttest_grep warning actual.err\n '\n \n-test_expect_success 'rename pretty print with nothing in common' '\n+test_expect_success 'rename pretty prints paths with nothing in common' '\n \tmkdir -p a/b/ &&\n \t: >a/b/c &&\n \tgit add a/b/c &&\n@@ -206,7 +195,7 @@ test_expect_success 'rename pretty print with nothing in common' '\n \ttest_grep \" a/b/c => c/b/a \" output\n '\n \n-test_expect_success 'rename pretty print with common prefix' '\n+test_expect_success 'rename pretty prints paths with common prefix' '\n \tmkdir -p c/d &&\n \tgit mv c/b/a c/d/e &&\n \tgit commit -m \"c/b/a -> c/d/e\" &&\n@@ -216,7 +205,7 @@ test_expect_success 'rename pretty print with common prefix' '\n \ttest_grep \" c/{b/a => d/e} \" output\n '\n \n-test_expect_success 'rename pretty print with common suffix' '\n+test_expect_success 'rename pretty prints paths with common suffix' '\n \tmkdir d &&\n \tgit mv c/d/e d/e &&\n \tgit commit -m \"c/d/e -> d/e\" &&\n@@ -226,7 +215,7 @@ test_expect_success 'rename pretty print with common suffix' '\n \ttest_grep \" {c/d => d}/e \" output\n '\n \n-test_expect_success 'rename pretty print with common prefix and suffix' '\n+test_expect_success 'rename pretty prints paths with common prefix and suffix' '\n \tmkdir d/f &&\n \tgit mv d/e d/f/e &&\n \tgit commit -m \"d/e -> d/f/e\" &&\n@@ -236,7 +225,7 @@ test_expect_success 'rename pretty print with common prefix and suffix' '\n \ttest_grep \" d/{ => f}/e \" output\n '\n \n-test_expect_success 'rename pretty print common prefix and suffix overlap' '\n+test_expect_success 'rename pretty prints paths with common prefix and suffix overlap' '\n \tmkdir d/f/f &&\n \tgit mv d/f/e d/f/f/e &&\n \tgit commit -m \"d/f/e d/f/f/e\" &&\n@@ -261,7 +250,7 @@ test_expect_success 'diff-tree -l0 defaults to a big rename limit, not zero' '\n \ttest_grep \"myotherfile.*myfile\" actual\n '\n \n-test_expect_success 'basename similarity vs best similarity' '\n+test_expect_success 'rename prefers basename similarity over best similarity' '\n \tmkdir subdir &&\n \ttest_write_lines line1 line2 line3 line4 line5 \\\n \t\t\t line6 line7 line8 line9 line10 >subdir/file.txt &&\n@@ -278,14 +267,14 @@ test_expect_success 'basename similarity vs best similarity' '\n \tgit diff-tree -r -M --name-status HEAD^ HEAD >actual &&\n \t# subdir/file.txt is 88% similar to file.md, 78% similar to file.txt,\n \t# but since same basenames are checked first...\n-\tcat >expected <<-\\EOF &&\n+\tcat >expect <<-\\EOF &&\n \tA\tfile.md\n \tR078\tsubdir/file.txt\tfile.txt\n \tEOF\n-\ttest_cmp expected actual\n+\ttest_cmp expect actual\n '\n \n-test_expect_success 'last line matters too' '\n+test_expect_success 'file similarity handles missing trailing newline.' '\n \t{\n \t\ttest_write_lines a 0 1 2 3 4 5 6 7 8 9 &&\n \t\tprintf \"git ignores final up to 63 characters if not newline terminated\"\n@@ -303,10 +292,10 @@ test_expect_success 'last line matters too' '\n \tgit commit -a -m \"rename no-final-lf -> still-absent-final-lf\" &&\n \tgit diff-tree -r -M --name-status HEAD^ HEAD >actual &&\n \tsed -e \"s/^R[0-9]*\t/R\t/\" actual >actual.munged &&\n-\tcat >expected <<-\\EOF &&\n+\tcat >expect <<-\\EOF &&\n \tR\tno-final-lf\tstill-absent-final-lf\n \tEOF\n-\ttest_cmp expected actual.munged\n+\ttest_cmp expect actual.munged\n '\n \n test_done\ndiff --git a/t/t4009-diff-rename-4.sh b/t/t4009-diff-rename-4.sh\nindex 59e71e3acd..198de5d039 100755\n--- a/t/t4009-diff-rename-4.sh\n+++ b/t/t4009-diff-rename-4.sh\n@@ -10,23 +10,23 @@ test_description='Same rename detection as t4003 but testing diff-raw -z.\n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/lib-diff.sh ;# test-lib chdir's into trash\n \n-test_expect_success \\\n-    'prepare reference tree' \\\n-    'COPYING_test_data >COPYING &&\n-     echo frotz >rezrov &&\n+test_expect_success  'prepare reference tree' '\n+    COPYING_test_data >COPYING &&\n+    echo frotz >rezrov &&\n     git update-index --add COPYING rezrov &&\n     orig=$(git hash-object COPYING) &&\n     tree=$(git write-tree) &&\n-    echo $tree'\n+    echo $tree\n+'\n \n-test_expect_success \\\n-    'prepare work tree' \\\n-    'sed -e 's/HOWEVER/However/' <COPYING >COPYING.1 &&\n-    sed -e 's/GPL/G.P.L/g' <COPYING >COPYING.2 &&\n+test_expect_success 'prepare work tree' '\n+    sed -e \"s/HOWEVER/However/\" <COPYING >COPYING.1 &&\n+    sed -e \"s/GPL/G.P.L/g\" <COPYING >COPYING.2 &&\n     rm -f COPYING &&\n     c1=$(git hash-object COPYING.1) &&\n     c2=$(git hash-object COPYING.2) &&\n-    git update-index --add --remove COPYING COPYING.?'\n+    git update-index --add --remove COPYING COPYING.?\n+'\n \n # tree has COPYING and rezrov.  work tree has COPYING.1 and COPYING.2,\n # both are slightly edited, and unchanged rezrov.  We say COPYING.1\n@@ -44,16 +44,16 @@ COPYING\n COPYING.2\n EOF\n \n-test_expect_success \\\n-    'validate output from rename/copy detection (#1)' \\\n-    'compare_diff_raw_z current expected'\n+test_expect_success 'validate output from rename/copy detection (#1)' '\n+    compare_diff_raw_z current expected\n+'\n \n ################################################################\n \n-test_expect_success \\\n-    'prepare work tree again' \\\n-    'mv COPYING.2 COPYING &&\n-     git update-index --add --remove COPYING COPYING.1 COPYING.2'\n+test_expect_success 'prepare work tree again' '\n+    mv COPYING.2 COPYING &&\n+    git update-index --add --remove COPYING COPYING.1 COPYING.2\n+'\n \n # tree has COPYING and rezrov.  work tree has COPYING and COPYING.1,\n # both are slightly edited, and unchanged rezrov.  We say COPYING.1\n@@ -69,9 +69,9 @@ COPYING\n COPYING.1\n EOF\n \n-test_expect_success \\\n-    'validate output from rename/copy detection (#2)' \\\n-    'compare_diff_raw_z current expected'\n+test_expect_success 'validate output from rename/copy detection (#2)' '\n+    compare_diff_raw_z current expected\n+'\n \n ################################################################\n \n@@ -80,10 +80,10 @@ test_expect_success \\\n # anything about rezrov or COPYING, since the revised again diff-raw\n # nows how to say Copy.\n \n-test_expect_success \\\n-    'prepare work tree once again' \\\n-    'COPYING_test_data >COPYING &&\n-     git update-index --add --remove COPYING COPYING.1'\n+test_expect_success 'prepare work tree once again' '\n+    COPYING_test_data >COPYING &&\n+    git update-index --add --remove COPYING COPYING.1\n+'\n \n git diff-index -z -C --find-copies-harder $tree >current\n cat >expected <<EOF\n@@ -92,8 +92,8 @@ COPYING\n COPYING.1\n EOF\n \n-test_expect_success \\\n-    'validate output from rename/copy detection (#3)' \\\n-    'compare_diff_raw_z current expected'\n+test_expect_success 'validate output from rename/copy detection (#3)' '\n+    compare_diff_raw_z current expected\n+'\n \n test_done\n\n-- \n2.53.0\n\n\n"},{"id":"552470","messageId":"20260910-modernize-t4001-v2-3-ac53e9f5d717@fastmail.com","threadId":"66305","inReplyTo":"20260910-modernize-t4001-v2-0-ac53e9f5d717@fastmail.com","subject":"[PATCH v2 3/3] Update t4010 to use modern style.","fromName":"Mark C. Chu-Carroll via B4 Relay","fromEmail":"devnull+markchucarroll.fastmail.com@kernel.org","sentAt":"2026-09-10T17:07:35Z","receivedAt":"2026-09-10T17:07:55Z","isPatch":true,"body":"From: \"Mark C. Chu-Carroll\" <markchucarroll@fastmail.com>\n\n---\n t/t4010-diff-pathspec.sh | 88 +++++++++++++++++-------------------------------\n 1 file changed, 31 insertions(+), 57 deletions(-)\n\ndiff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh\nindex 8d980823b0..76ddd3ff4e 100755\n--- a/t/t4010-diff-pathspec.sh\n+++ b/t/t4010-diff-pathspec.sh\n@@ -13,60 +13,34 @@ Prepare:\n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/lib-diff.sh ;# test-lib chdir's into trash\n \n-test_expect_success \\\n-    setup \\\n-    'echo frotz >file0 &&\n-     mkdir path1 &&\n-     echo rezrov >path1/file1 &&\n-     before0=$(git hash-object file0) &&\n-     before1=$(git hash-object path1/file1) &&\n-     git update-index --add file0 path1/file1 &&\n-     tree=$(git write-tree) &&\n-     echo \"$tree\" &&\n-     echo nitfol >file0 &&\n-     echo yomin >path1/file1 &&\n-     after0=$(git hash-object file0) &&\n-     after1=$(git hash-object path1/file1) &&\n-     git update-index file0 path1/file1'\n-\n-cat >expected <<\\EOF\n-EOF\n-test_expect_success \\\n-    'limit to path should show nothing' \\\n-    'git diff-index --cached $tree -- path >current &&\n-     compare_diff_raw current expected'\n-\n-cat >expected <<EOF\n-:100644 100644 $before1 $after1 M\tpath1/file1\n-EOF\n-test_expect_success \\\n-    'limit to path1 should show path1/file1' \\\n-    'git diff-index --cached $tree -- path1 >current &&\n-     compare_diff_raw current expected'\n-\n-cat >expected <<EOF\n-:100644 100644 $before1 $after1 M\tpath1/file1\n-EOF\n-test_expect_success \\\n-    'limit to path1/ should show path1/file1' \\\n-    'git diff-index --cached $tree -- path1/ >current &&\n-     compare_diff_raw current expected'\n-\n-cat >expected <<EOF\n-:100644 100644 $before1 $after1 M\tpath1/file1\n-EOF\n-test_expect_success \\\n-    '\"*file1\" should show path1/file1' \\\n-    'git diff-index --cached $tree -- \"*file1\" >current &&\n-     compare_diff_raw current expected'\n-\n-cat >expected <<EOF\n-:100644 100644 $before0 $after0 M\tfile0\n-EOF\n-test_expect_success \\\n-    'limit to file0 should show file0' \\\n-    'git diff-index --cached $tree -- file0 >current &&\n-     compare_diff_raw current expected'\n+\n+test_expect_success 'limit to path should show nothing' '\n+\techo frotz >file0 &&\n+\tmkdir path1 &&\n+\techo rezrov >path1/file1 &&\n+\tbefore0=$(git hash-object file0) &&\n+\tbefore1=$(git hash-object path1/file1) &&\n+\tgit update-index --add file0 path1/file1 &&\n+\ttree=$(git write-tree) &&\n+\techo \"$tree\" &&\n+\techo nitfol >file0 &&\n+\techo yomin >path1/file1 &&\n+\tafter0=$(git hash-object file0) &&\n+\tafter1=$(git hash-object path1/file1) &&\n+\tgit update-index file0 path1/file1 &&\n+\t: >expected &&\n+\tgit diff-index --cached $tree -- path >current &&\n+\tcompare_diff_raw current expected\n+'\n+\n+test_expect_success 'limit to path1 should show path1/file1' '\n+\tcat >expected <<-EOF &&\n+\t:100644 100644 $before1 $after1 M\tpath1/file1\n+\tEOF\n+\n+\tgit diff-index --cached $tree -- path1 >current &&\n+\tcompare_diff_raw current expected\n+'\n \n test_expect_success 'limit to path1/ should show path1/file1' '\n \tcat >expected <<-EOF &&\n@@ -80,7 +54,7 @@ test_expect_success '\"*file1\" should show path1/file1' '\n \tcat >expected <<-EOF &&\n \t:100644 100644 $before1 $after1 M\tpath1/file1\n \tEOF\n-    \n+\n \tgit diff-index --cached $tree -- \"*file1\" >current &&\n \tcompare_diff_raw current expected\n '\n@@ -89,13 +63,13 @@ test_expect_success 'limit to file0 should show file0' '\n \tcat >expected <<-EOF &&\n \t:100644 100644 $before0 $after0 M\tfile0\n \tEOF\n-    \n+\n \tgit diff-index --cached $tree -- file0 >current &&\n \tcompare_diff_raw current expected\n '\n \n test_expect_success 'limit to file0/ should emit nothing.' '\n-    : >expected &&     \n+    : >expected &&\n \tgit diff-index --cached $tree -- file0/ >current &&\n \tcompare_diff_raw current expected\n '\n\n-- \n2.53.0\n\n\n"},{"id":"552472","messageId":"20260910-modernize-t4001-v2-2-ac53e9f5d717@fastmail.com","threadId":"66305","inReplyTo":"20260910-modernize-t4001-v2-0-ac53e9f5d717@fastmail.com","subject":"[PATCH v2 2/3] Update t4009 to use modern style.","fromName":"Mark C. Chu-Carroll via B4 Relay","fromEmail":"devnull+markchucarroll.fastmail.com@kernel.org","sentAt":"2026-09-10T17:07:34Z","receivedAt":"2026-09-10T17:07:55Z","isPatch":true,"body":"From: \"Mark C. Chu-Carroll\" <markchucarroll@fastmail.com>\n\n---\n t/t4009-diff-rename-4.sh | 113 ++++++++++++++++++++++-------------------------\n 1 file changed, 54 insertions(+), 59 deletions(-)\n\ndiff --git a/t/t4009-diff-rename-4.sh b/t/t4009-diff-rename-4.sh\nindex 198de5d039..7a48a7011c 100755\n--- a/t/t4009-diff-rename-4.sh\n+++ b/t/t4009-diff-rename-4.sh\n@@ -10,67 +10,64 @@ test_description='Same rename detection as t4003 but testing diff-raw -z.\n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/lib-diff.sh ;# test-lib chdir's into trash\n \n-test_expect_success  'prepare reference tree' '\n+\n+\n+test_expect_success 'validate output from rename/copy detection (#1)' '\n+    # prepare reference tree\n     COPYING_test_data >COPYING &&\n     echo frotz >rezrov &&\n     git update-index --add COPYING rezrov &&\n     orig=$(git hash-object COPYING) &&\n     tree=$(git write-tree) &&\n-    echo $tree\n-'\n-\n-test_expect_success 'prepare work tree' '\n+    echo $tree &&\n+    # prepare work tree\n     sed -e \"s/HOWEVER/However/\" <COPYING >COPYING.1 &&\n     sed -e \"s/GPL/G.P.L/g\" <COPYING >COPYING.2 &&\n     rm -f COPYING &&\n     c1=$(git hash-object COPYING.1) &&\n     c2=$(git hash-object COPYING.2) &&\n-    git update-index --add --remove COPYING COPYING.?\n-'\n-\n-# tree has COPYING and rezrov.  work tree has COPYING.1 and COPYING.2,\n-# both are slightly edited, and unchanged rezrov.  We say COPYING.1\n-# and COPYING.2 are based on COPYING, and do not say anything about\n-# rezrov.\n-\n-git diff-index -z -C $tree >current\n-\n-cat >expected <<EOF\n-:100644 100644 $orig $c1 C1234\n-COPYING\n-COPYING.1\n-:100644 100644 $orig $c2 R1234\n-COPYING\n-COPYING.2\n-EOF\n-\n-test_expect_success 'validate output from rename/copy detection (#1)' '\n-    compare_diff_raw_z current expected\n+\tgit update-index --add --remove COPYING COPYING.? &&\n+\n+\t# tree has COPYING and rezrov.  work tree has COPYING.1 and COPYING.2,\n+\t# both are slightly edited, and unchanged rezrov.  We say COPYING.1\n+\t# and COPYING.2 are based on COPYING, and do not say anything about\n+\t# rezrov.\n+\n+    cat >expect <<-EOF &&\n+\t:100644 100644 $orig $c1 C1234\n+\tCOPYING\n+\tCOPYING.1\n+\t:100644 100644 $orig $c2 R1234\n+\tCOPYING\n+\tCOPYING.2\n+\tEOF\n+\n+    git diff-index -z -C $tree >actual &&\n+    compare_diff_raw_z actual expect\n '\n \n ################################################################\n \n-test_expect_success 'prepare work tree again' '\n-    mv COPYING.2 COPYING &&\n-    git update-index --add --remove COPYING COPYING.1 COPYING.2\n-'\n-\n-# tree has COPYING and rezrov.  work tree has COPYING and COPYING.1,\n-# both are slightly edited, and unchanged rezrov.  We say COPYING.1\n-# is based on COPYING and COPYING is still there, and do not say anything\n-# about rezrov.\n-\n-git diff-index -z -C $tree >current\n-cat >expected <<EOF\n-:100644 100644 $orig $c2 M\n-COPYING\n-:100644 100644 $orig $c1 C1234\n-COPYING\n-COPYING.1\n-EOF\n-\n test_expect_success 'validate output from rename/copy detection (#2)' '\n-    compare_diff_raw_z current expected\n+    # prepare work tree again\n+    mv COPYING.2 COPYING &&\n+    git update-index --add --remove COPYING COPYING.1 COPYING.2 &&\n+\n+\t# tree has COPYING and rezrov.  work tree has COPYING and COPYING.1,\n+\t# both are slightly edited, and unchanged rezrov.  We say COPYING.1\n+\t# is based on COPYING and COPYING is still there, and do not say anything\n+\t# about rezrov.\n+\n+\tgit diff-index -z -C $tree >actual &&\n+\tcat >expect <<-EOF &&\n+\t:100644 100644 $orig $c2 M\n+\tCOPYING\n+\t:100644 100644 $orig $c1 C1234\n+\tCOPYING\n+\tCOPYING.1\n+\tEOF\n+\n+    compare_diff_raw_z actual expect\n '\n \n ################################################################\n@@ -80,20 +77,18 @@ test_expect_success 'validate output from rename/copy detection (#2)' '\n # anything about rezrov or COPYING, since the revised again diff-raw\n # nows how to say Copy.\n \n-test_expect_success 'prepare work tree once again' '\n-    COPYING_test_data >COPYING &&\n-    git update-index --add --remove COPYING COPYING.1\n-'\n-\n-git diff-index -z -C --find-copies-harder $tree >current\n-cat >expected <<EOF\n-:100644 100644 $orig $c1 C1234\n-COPYING\n-COPYING.1\n-EOF\n-\n test_expect_success 'validate output from rename/copy detection (#3)' '\n-    compare_diff_raw_z current expected\n+    # prepare work tree once again\n+    COPYING_test_data >COPYING &&\n+    git update-index --add --remove COPYING COPYING.1 &&\n+    git diff-index -z -C --find-copies-harder $tree >actual &&\n+    cat >expect <<-EOF &&\n+\t:100644 100644 $orig $c1 C1234\n+\tCOPYING\n+\tCOPYING.1\n+\tEOF\n+\n+    compare_diff_raw_z actual expect\n '\n \n test_done\n\n-- \n2.53.0\n\n\n"},{"id":"552479","messageId":"xmqqv78ddm7t.fsf@gitster.g","threadId":"66305","inReplyTo":"20260910-modernize-t4001-v2-1-ac53e9f5d717@fastmail.com","subject":"Re: [PATCH v2 1/3] Update t4001 to use modern syntax.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-09-10T17:56:22Z","receivedAt":"2026-09-10T17:56:25Z","isPatch":true,"body":"\"Mark C. Chu-Carroll via B4 Relay\"\n<devnull+markchucarroll.fastmail.com@kernel.org> writes:\n\n> Subject: [PATCH v2 1/3] Update t4001 to use modern syntax.\n\nDocumentation/SubmittingPatches::[[summary-section]]\n\nAlso \"git log --oneline --no-merges -60 origin -- t/\" may give us\nsome hint.\n\n> From: \"Mark C. Chu-Carroll\" <markchucarroll@fastmail.com>\n>\n\nDocumentation/SubmittingPatches::[[describe-changes]]\n\n> ---\n\nDocumentation/SubmittingPatches::[[sign-off]]\n"}]}