{"thread":{"id":"66343","subject":"[PATCH v3 0/3] Update t40* tests to use modern style.","startedAt":"2026-09-17T19:54:39Z","lastAt":"2026-09-18T14:54:18Z","messageCount":6,"participants":["Mark C. Chu-Carroll","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":3},"messages":[{"id":"552834","messageId":"20260917195436.1102981-1-markchucarroll@fastmail.com","threadId":"66343","inReplyTo":null,"subject":"[PATCH v3 0/3] Update t40* tests to use modern style.","fromName":"Mark C. Chu-Carroll","fromEmail":"markchucarroll@fastmail.com","sentAt":"2026-09-17T19:54:33Z","receivedAt":"2026-09-17T19:54:39Z","isPatch":true,"body":"Update t4001 to use modern style.\n\nOld 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(Note: I somehow munged the b4 state of this series; I've done my\nbest to fix it, but there may be threading artifacts in the email.)\n\nMark C. Chu-Carroll (3):\n  Update t/t4001-diff-rename.sh to modern style.\n  Update t/t4009-diff-rename-4 to use modern style.\n  Update t/t4010-diff-pathspec.sh to modern style.\n\n t/t4001-diff-rename.sh   |  97 +++++++++++++----------------\n t/t4009-diff-rename-4.sh | 131 +++++++++++++++++++--------------------\n t/t4010-diff-pathspec.sh | 121 ++++++++++++++++++------------------\n 3 files changed, 166 insertions(+), 183 deletions(-)\n\n-- \n2.53.0\n\n"},{"id":"552835","messageId":"20260917195436.1102981-2-markchucarroll@fastmail.com","threadId":"66343","inReplyTo":"20260917195436.1102981-1-markchucarroll@fastmail.com","subject":"[PATCH v3 1/3] Update t/t4001-diff-rename.sh to modern style.","fromName":"Mark C. Chu-Carroll","fromEmail":"markchucarroll@fastmail.com","sentAt":"2026-09-17T19:54:34Z","receivedAt":"2026-09-17T19:54:45Z","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\nSigned-off-by: Mark C. Chu-Carroll <markchucarroll@fastmail.com>\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-- \n2.53.0\n\n"},{"id":"552836","messageId":"20260917195436.1102981-3-markchucarroll@fastmail.com","threadId":"66343","inReplyTo":"20260917195436.1102981-1-markchucarroll@fastmail.com","subject":"[PATCH v3 2/3] Update t/t4009-diff-rename-4 to use modern style.","fromName":"Mark C. Chu-Carroll","fromEmail":"markchucarroll@fastmail.com","sentAt":"2026-09-17T19:54:35Z","receivedAt":"2026-09-17T19:54:47Z","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\nSigned-off-by: Mark C. Chu-Carroll <markchucarroll@fastmail.com>\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-- \n2.53.0\n\n"},{"id":"552837","messageId":"20260917195436.1102981-4-markchucarroll@fastmail.com","threadId":"66343","inReplyTo":"20260917195436.1102981-1-markchucarroll@fastmail.com","subject":"[PATCH v3 3/3] Update t/t4010-diff-pathspec.sh to modern style.","fromName":"Mark C. Chu-Carroll","fromEmail":"markchucarroll@fastmail.com","sentAt":"2026-09-17T19:54:36Z","receivedAt":"2026-09-17T19:54:48Z","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\nSigned-off-by: Mark C. Chu-Carroll <markchucarroll@fastmail.com>\n---\n t/t4010-diff-pathspec.sh | 121 +++++++++++++++++++--------------------\n 1 file changed, 60 insertions(+), 61 deletions(-)\n\ndiff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh\nindex c84c3fa05b..76ddd3ff4e 100755\n--- a/t/t4010-diff-pathspec.sh\n+++ b/t/t4010-diff-pathspec.sh\n@@ -13,67 +13,66 @@ 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 \"$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+    : >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":"552849","messageId":"xmqqjyojowzo.fsf@gitster.g","threadId":"66343","inReplyTo":"20260917195436.1102981-2-markchucarroll@fastmail.com","subject":"Re: [PATCH v3 1/3] Update t/t4001-diff-rename.sh to modern style.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-09-18T07:10:51Z","receivedAt":"2026-09-18T07:10:54Z","isPatch":true,"body":"\"Mark C. Chu-Carroll\" <markchucarroll@fastmail.com> writes:\n\n> Subject: Re: [PATCH v3 1/3] Update t/t4001-diff-rename.sh to modern style.\n\nDocumentation/SubmittingPatches::[[summary-section]]\n\nPerhaps\n\n    Subject: [PATCH v3 1/3] t4001: modernize\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\nThat is a laudable goal, but enumerate the rules you followed to\nachieve that goal.  For example, a few of them may have been\n\n * Run everything inside test_expect_success block.\n\n * Write the title on the same line as test_expect_success and end\n   that line with a singul quote that opens the body of the test; a\n   line with a sole single quote then closes the body.\n\n\n> Signed-off-by: Mark C. Chu-Carroll <markchucarroll@fastmail.com>\n> ---\n\n> -test_expect_success 'setup' '\n> +initial_setup () {\n\nWhy a shell function that is called only once by a test titled \"Diff\nshows path0 ...\" below?  It is customary to perform the setup in the\nvery first test_expect_success whose title is 'setup'.  I doubt it\nwould contribute to better readability to change that.\n\n> -test_expect_success 'test diff.renames=true' '\n> +test_expect_success 'With diff.renames=true, patch includes rename of path0 to path1' '\n> -test_expect_success 'test diff.renames=false' '\n> +test_expect_success 'With diff.renames=false, patch does not include rename' '\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\nHere you are failing to follow your own renaming rules to start test\ntitles in uppercase letters.  I personally wouldn't have chosen to\nupcase many of them; rather, the majority of tests in this file seem\nto be named in lowercase so I would have instead made sure I'd start\nthem in lowercase as well.  In any case, please be consistent.\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\nGood eyes ;-).\n\n> -test_expect_success 'rename pretty print with common prefix' '\n> +test_expect_success 'rename pretty prints paths with common prefix' '\n\nMeh.\n\nNeither way, it is grammatical at all 'rename' may not be plural, so\nthe verb 'print' may want 's' for third-person-singular, but it does\nnot make sense to use 'rename' as the subject for \"pretty-print\"\nanyway.  It is not that 'rename' is the one that prints something.\n\n"},{"id":"552864","messageId":"DLIJ195ABVQL.3OD6QX7D3VNBE@fastmail.com","threadId":"66343","inReplyTo":"xmqqjyojowzo.fsf@gitster.g","subject":"Re: [PATCH v3 1/3] Update t/t4001-diff-rename.sh to modern style.","fromName":"Mark C. Chu-Carroll","fromEmail":"markchucarroll@fastmail.com","sentAt":"2026-09-18T14:54:15Z","receivedAt":"2026-09-18T14:54:18Z","isPatch":true,"body":"On Fri Sep 18, 2026 at 3:10 AM EDT, Junio C Hamano wrote:\n> \"Mark C. Chu-Carroll\" <markchucarroll@fastmail.com> writes:\n>\n>> Subject: Re: [PATCH v3 1/3] Update t/t4001-diff-rename.sh to modern style.\n>\n> Documentation/SubmittingPatches::[[summary-section]]\n>\n> Perhaps\n>\n>     Subject: [PATCH v3 1/3] t4001: modernize\n\nGood suggestion, thanks.\n\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> That is a laudable goal, but enumerate the rules you followed to\n> achieve that goal.  For example, a few of them may have been\n>\n>  * Run everything inside test_expect_success block.\n>\n>  * Write the title on the same line as test_expect_success and end\n>    that line with a singul quote that opens the body of the test; a\n>    line with a sole single quote then closes the body.\n>\n>\n>> Signed-off-by: Mark C. Chu-Carroll <markchucarroll@fastmail.com>\n>> ---\n>\n>> -test_expect_success 'setup' '\n>> +initial_setup () {\n>\n> Why a shell function that is called only once by a test titled \"Diff\n> shows path0 ...\" below?  It is customary to perform the setup in the\n> very first test_expect_success whose title is 'setup'.  I doubt it\n> would contribute to better readability to change that.\n\nI went back and forth on that in terms of readability. I'll switch\nit back.\n\n>\n>> -test_expect_success 'test diff.renames=true' '\n>> +test_expect_success 'With diff.renames=true, patch includes rename of path0 to path1' '\n>> -test_expect_success 'test diff.renames=false' '\n>> +test_expect_success 'With diff.renames=false, patch does not include rename' '\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>\n> Here you are failing to follow your own renaming rules to start test\n> titles in uppercase letters.  I personally wouldn't have chosen to\n> upcase many of them; rather, the majority of tests in this file seem\n> to be named in lowercase so I would have instead made sure I'd start\n> them in lowercase as well.  In any case, please be consistent.\n\nGood eye - I didn't even see that.\n\n>> -test_expect_success 'rename pretty print with common prefix' '\n>> +test_expect_success 'rename pretty prints paths with common prefix' '\n>\n> Meh.\n>\n> Neither way, it is grammatical at all 'rename' may not be plural, so\n> the verb 'print' may want 's' for third-person-singular, but it does\n> not make sense to use 'rename' as the subject for \"pretty-print\"\n> anyway.  It is not that 'rename' is the one that prints something.\n>\n\nI'll try to come up with something better.\n\nThanks for the review! I'll send an update later today.\n\n         -Mark\n\n\n-- \nMark Craig Chu-Carroll (@MarkChuCarroll at gitlab)\n*** Software Tools/Math Geek - Software Engineer at Gitlab\n*** Work Email: mcarroll@gitlab.com / markchucarroll@fastmail.com\n*** Personal Blog: http://goodmath.org/blog / Personal email: markcc@gmail.com\n\n"}]}