{"thread":{"id":"66367","subject":"[PATCH v5 0/3] t40*: modernize","startedAt":"2026-09-22T14:31:23Z","lastAt":"2026-09-22T19:41:58Z","messageCount":5,"participants":["Mark C. Chu-Carroll","Junio C Hamano"],"isPatch":true,"patchVersion":5,"patchTotal":3},"messages":[{"id":"552991","messageId":"20260922143119.3313620-1-markchucarroll@fastmail.com","threadId":"66367","inReplyTo":null,"subject":"[PATCH v5 0/3] t40*: modernize","fromName":"Mark C. Chu-Carroll","fromEmail":"markchucarroll@fastmail.com","sentAt":"2026-09-22T14:31:16Z","receivedAt":"2026-09-22T14:31:23Z","isPatch":true,"body":"Changes in v5:\n- Update t4001.sh to the correct commit version. (Argh!)\n\n- Link to v4: https://lore.kernel.org/git/20260918171847.2670739-1-markchucarroll@fastmail.com/\n\nChanges in v4:\n- use a \"test_expect_success 'setup'\" instead of setup functions\n- make capitalization in test assertions consistent.\n- improve naming of rename tests.\n- make all indentations use tabs correctly.\n\n- Link to v3: https://lore.kernel.org/all/20260917195436.1102981-1-markchucarroll@fastmail.com/\n\nChanges in v3:\n- Correct cover letter and commit message issues\n\n- Link to v2: https://lore.kernel.org/all/20260910-modernize-t4001-v2-0-ac53e9f5d717@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\nMark C. Chu-Carroll (3):\n  t4001: modernize\n  t4009: modernize\n  t4010: modernize\n\n t/t4001-diff-rename.sh   |  91 +++++++++++--------------\n t/t4009-diff-rename-4.sh | 142 +++++++++++++++++++--------------------\n t/t4010-diff-pathspec.sh | 120 ++++++++++++++++-----------------\n 3 files changed, 166 insertions(+), 187 deletions(-)\n\n-- \n2.53.0\n\n"},{"id":"552992","messageId":"20260922143119.3313620-2-markchucarroll@fastmail.com","threadId":"66367","inReplyTo":"20260922143119.3313620-1-markchucarroll@fastmail.com","subject":"[PATCH v5 1/3] t4001: modernize","fromName":"Mark C. Chu-Carroll","fromEmail":"markchucarroll@fastmail.com","sentAt":"2026-09-22T14:31:17Z","receivedAt":"2026-09-22T14:31:25Z","isPatch":true,"body":"Old tests were written in a different style than modern\nones; for better readability and test error messages,\nupdate t4001 to the modern style.\n\n* run everything inside of a test_expect_success block.\n* write title line on the same line as test_expect_success,\n  end that line with a single quote that opens the body of the test,\n  and end the test with a single quote that closes the body.\n* write expected output of a test to a file named \"expect\",\n  and actual output to a file named \"actual\".\n* write here-docs using \"<<-\" syntax, so that they're indented\n  uniformly with the rest of the test.\n* make test names more clearly reflect the functionality that\n  they test.\n\nSigned-off-by: Mark C. Chu-Carroll <markchucarroll@fastmail.com>\n---\n t/t4001-diff-rename.sh   | 91 +++++++++++++++++-----------------------\n t/t4009-diff-rename-4.sh | 54 ++++++++++++------------\n 2 files changed, 66 insertions(+), 79 deletions(-)\n\ndiff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh\nindex ad474100af..158cc66cec 100755\n--- a/t/t4001-diff-rename.sh\n+++ b/t/t4001-diff-rename.sh\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,34 @@ test_expect_success 'setup' '\n \t+Line 14\n \t+Line 15\n \tEOF\n+\tgit update-index --add path0\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-\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+\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 +124,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 'rename logic 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 +154,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 +164,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 +179,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 'pretty-print paths with nothing in common after rename' '\n \tmkdir -p a/b/ &&\n \t: >a/b/c &&\n \tgit add a/b/c &&\n@@ -206,7 +193,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 'pretty print paths with common prefix after rename' '\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 +203,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 'pretty prints paths with common suffix after rename' '\n \tmkdir d &&\n \tgit mv c/d/e d/e &&\n \tgit commit -m \"c/d/e -> d/e\" &&\n@@ -226,7 +213,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 'pretty prints paths with common prefix and suffix after rename' '\n \tmkdir d/f &&\n \tgit mv d/e d/f/e &&\n \tgit commit -m \"d/e -> d/f/e\" &&\n@@ -236,7 +223,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 'pretty prints paths with common prefix and suffix overlap after rename' '\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 +248,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 +265,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 +290,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-- \n2.53.0\n\n"},{"id":"552993","messageId":"20260922143119.3313620-3-markchucarroll@fastmail.com","threadId":"66367","inReplyTo":"20260922143119.3313620-1-markchucarroll@fastmail.com","subject":"[PATCH v5 2/3] t4009: modernize","fromName":"Mark C. Chu-Carroll","fromEmail":"markchucarroll@fastmail.com","sentAt":"2026-09-22T14:31:18Z","receivedAt":"2026-09-22T14:31:26Z","isPatch":true,"body":"Old tests were written in a different style than modern\nones; for better readability and test error messages,\nupdate t4009 to the modern style.\n\n* run everything inside of a test_expect_success block.\n* write title line on the same line as test_expect_success,\n  end that line with a single quote that opens the body of the test,\n  and end the test with a single quote that closes the body.\n* write expected output of a test to a file named \"expect\",\n  and actual output to a file named \"actual\".\n* write here-docs using \"<<-\" syntax, so that they're indented\n  uniformly with the rest of the test.\n* make test names more clearly reflect the functionality that\n  they test.\n\nSigned-off-by: Mark C. Chu-Carroll <markchucarroll@fastmail.com>\n---\n t/t4009-diff-rename-4.sh | 126 +++++++++++++++++++--------------------\n 1 file changed, 60 insertions(+), 66 deletions(-)\n\ndiff --git a/t/t4009-diff-rename-4.sh b/t/t4009-diff-rename-4.sh\nindex 198de5d039..e42891ee5a 100755\n--- a/t/t4009-diff-rename-4.sh\n+++ b/t/t4009-diff-rename-4.sh\n@@ -10,67 +10,63 @@ 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-    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+test_expect_success 'setup' '\n+\t# prepare reference tree\n+\tCOPYING_test_data >COPYING &&\n+\techo frotz >rezrov &&\n+\tgit update-index --add COPYING rezrov &&\n+\torig=$(git hash-object COPYING) &&\n+\ttree=$(git write-tree) &&\n+\techo $tree &&\n+\t# prepare work tree\n+\tsed -e \"s/HOWEVER/However/\" <COPYING >COPYING.1 &&\n+\tsed -e \"s/GPL/G.P.L/g\" <COPYING >COPYING.2 &&\n+\trm -f COPYING &&\n+\tc1=$(git hash-object COPYING.1) &&\n+\tc2=$(git hash-object COPYING.2) &&\n+\tgit update-index --add --remove COPYING COPYING.?\n '\n \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-'\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+\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+\tcat >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+\tgit diff-index -z -C $tree >actual &&\n+\tcompare_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+\t# prepare work tree again\n+\tmv COPYING.2 COPYING &&\n+\tgit 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+\tcompare_diff_raw_z actual expect\n '\n \n ################################################################\n@@ -80,20 +76,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+\t# prepare work tree once again\n+\tCOPYING_test_data >COPYING &&\n+\tgit update-index --add --remove COPYING COPYING.1 &&\n+\tgit diff-index -z -C --find-copies-harder $tree >actual &&\n+\tcat >expect <<-EOF &&\n+\t:100644 100644 $orig $c1 C1234\n+\tCOPYING\n+\tCOPYING.1\n+\tEOF\n+\n+\tcompare_diff_raw_z actual expect\n '\n \n test_done\n-- \n2.53.0\n\n"},{"id":"552994","messageId":"20260922143119.3313620-4-markchucarroll@fastmail.com","threadId":"66367","inReplyTo":"20260922143119.3313620-1-markchucarroll@fastmail.com","subject":"[PATCH v5 3/3] t4010: modernize","fromName":"Mark C. Chu-Carroll","fromEmail":"markchucarroll@fastmail.com","sentAt":"2026-09-22T14:31:19Z","receivedAt":"2026-09-22T14:31:28Z","isPatch":true,"body":"Old tests were written in a different style than modern\nones; for better readability and test error messages,\nupdate t4010 to the modern style.\n\n* run everything inside of a test_expect_success block.\n* write title line on the same line as test_expect_success,\n  end that line with a single quote that opens the body of the test,\n  and end the test with a single quote that closes the body.\n* write expected output of a test to a file named \"expect\",\n  and actual output to a file named \"actual\".\n* write here-docs using \"<<-\" syntax, so that they're indented\n  uniformly with the rest of the test.\n* make test names more clearly reflect the functionality that\n  they test.\n\nSigned-off-by: Mark C. Chu-Carroll <markchucarroll@fastmail.com>\n---\n t/t4010-diff-pathspec.sh | 120 +++++++++++++++++++--------------------\n 1 file changed, 59 insertions(+), 61 deletions(-)\n\ndiff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh\nindex c84c3fa05b..34d53e7496 100755\n--- a/t/t4010-diff-pathspec.sh\n+++ b/t/t4010-diff-pathspec.sh\n@@ -13,67 +13,65 @@ 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-cat >expected <<\\EOF\n-EOF\n-test_expect_success \\\n-    'limit to file0/ should emit nothing.' \\\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 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+\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+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+\tgit diff-index --cached $tree -- \"*file1\" >current &&\n+\tcompare_diff_raw current expected\n+'\n+\n+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+\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+\t: >expected &&\n+\tgit diff-index --cached $tree -- file0/ >current &&\n+\tcompare_diff_raw current expected\n+'\n \n test_expect_success 'diff-tree pathspec' '\n \ttree2=$(git write-tree) &&\n-- \n2.53.0\n\n"},{"id":"553011","messageId":"xmqqa4p9dqez.fsf@gitster.g","threadId":"66367","inReplyTo":"20260922143119.3313620-2-markchucarroll@fastmail.com","subject":"Re: [PATCH v5 1/3] t4001: modernize","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-09-22T19:41:56Z","receivedAt":"2026-09-22T19:41:58Z","isPatch":true,"body":"\"Mark C. Chu-Carroll\" <markchucarroll@fastmail.com> writes:\n\n> Old tests were written in a different style than modern\n> ones; for better readability and test error messages,\n> update t4001 to the modern style.\n>\n> * run everything inside of a test_expect_success block.\n> * write title line on the same line as test_expect_success,\n>   end that line with a single quote that opens the body of the test,\n>   and end the test with a single quote that closes the body.\n> * write expected output of a test to a file named \"expect\",\n>   and actual output to a file named \"actual\".\n> * write here-docs using \"<<-\" syntax, so that they're indented\n>   uniformly with the rest of the test.\n> * make test names more clearly reflect the functionality that\n>   they test.\n>\n> Signed-off-by: Mark C. Chu-Carroll <markchucarroll@fastmail.com>\n> ---\n>  t/t4001-diff-rename.sh   | 91 +++++++++++++++++-----------------------\n>  t/t4009-diff-rename-4.sh | 54 ++++++++++++------------\n>  2 files changed, 66 insertions(+), 79 deletions(-)\n\nRebase glitch?  The claim above is that this is about updating t4001\nbut it seems that a half of t4009 updates are mixed in.\n"}]}