{"thread":{"id":"66297","subject":"[PATCH 0/3] Update t40* tests to use modern style.","startedAt":"2026-09-08T19:45:02Z","lastAt":"2026-09-08T20:48:36Z","messageCount":5,"participants":["Mark C. Chu-Carroll via B4 Relay","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"552246","messageId":"20260908-modernize-t4001-v1-0-cab3933a173f@fastmail.com","threadId":"66297","inReplyTo":null,"subject":"[PATCH 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-08T19:44:52Z","receivedAt":"2026-09-08T19:45:02Z","isPatch":true,"body":"Signed-off-by: Mark C. Chu-Carroll <markchucarroll@fastmail.com>\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   | 31 +++++++++----------\n t/t4009-diff-rename-4.sh | 54 ++++++++++++++++-----------------\n t/t4010-diff-pathspec.sh | 78 ++++++++++++++++++++++++------------------------\n 3 files changed, 82 insertions(+), 81 deletions(-)\n\n\n---\nbase-commit: b8242b093d9e941a34460d715e3ce616a34ac3fe\nchange-id: 20260908-modernize-t4001-fb43302caaf9\n\n\n"},{"id":"552247","messageId":"20260908-modernize-t4001-v1-1-cab3933a173f@fastmail.com","threadId":"66297","inReplyTo":"20260908-modernize-t4001-v1-0-cab3933a173f@fastmail.com","subject":"[PATCH 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-08T19:44:53Z","receivedAt":"2026-09-08T19:45:02Z","isPatch":true,"body":"From: \"Mark C. Chu-Carroll\" <markchucarroll@fastmail.com>\n\n---\n t/t4001-diff-rename.sh   | 31 ++++++++++++++++---------------\n t/t4009-diff-rename-4.sh |  8 ++++----\n 2 files changed, 20 insertions(+), 19 deletions(-)\n\ndiff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh\nindex ad474100af..2aa161c217 100755\n--- a/t/t4001-diff-rename.sh\n+++ b/t/t4001-diff-rename.sh\n@@ -88,28 +88,29 @@ test_expect_success 'setup' '\n \tEOF\n '\n \n-test_expect_success \\\n-    'update-index --add a file.' \\\n-    'git update-index --add path0'\n+test_expect_success 'update-index --add a file.' '\n+    git update-index --add path0\n+'\n \n-test_expect_success \\\n-    'write that tree.' \\\n-    'tree=$(git write-tree) && echo $tree'\n+test_expect_success 'write that tree.' '\n+    tree=$(git write-tree) && echo $tree\n+'\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+test_expect_success 'renamed and edited the file.' '\n+    git update-index --add --remove path0 path1\n+'\n+\n+test_expect_success 'git diff-index -p -M after rename and editing.' '\n+    git diff-index -p -M $tree >current\n+'\n \n \n-test_expect_success \\\n-    'validate the output.' \\\n-    'compare_diff_patch current expected'\n+test_expect_success 'validate the output.' '\n+    compare_diff_patch current expected\n+'\n \n test_expect_success 'test diff.renames=true' '\n \tgit -c diff.renames=true diff --cached $tree >current &&\ndiff --git a/t/t4009-diff-rename-4.sh b/t/t4009-diff-rename-4.sh\nindex 59e71e3acd..8f86dc7274 100755\n--- a/t/t4009-diff-rename-4.sh\n+++ b/t/t4009-diff-rename-4.sh\n@@ -19,10 +19,10 @@ test_expect_success \\\n     tree=$(git write-tree) &&\n     echo $tree'\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+\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\n-- \n2.53.0\n\n\n"},{"id":"552248","messageId":"20260908-modernize-t4001-v1-2-cab3933a173f@fastmail.com","threadId":"66297","inReplyTo":"20260908-modernize-t4001-v1-0-cab3933a173f@fastmail.com","subject":"[PATCH 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-08T19:44:54Z","receivedAt":"2026-09-08T19:45:02Z","isPatch":true,"body":"From: \"Mark C. Chu-Carroll\" <markchucarroll@fastmail.com>\n\n---\n t/t4009-diff-rename-4.sh | 48 ++++++++++++++++++++++++------------------------\n 1 file changed, 24 insertions(+), 24 deletions(-)\n\ndiff --git a/t/t4009-diff-rename-4.sh b/t/t4009-diff-rename-4.sh\nindex 8f86dc7274..198de5d039 100755\n--- a/t/t4009-diff-rename-4.sh\n+++ b/t/t4009-diff-rename-4.sh\n@@ -10,15 +10,14 @@ 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-\n+    echo $tree\n+'\n \n test_expect_success 'prepare work tree' '\n     sed -e \"s/HOWEVER/However/\" <COPYING >COPYING.1 &&\n@@ -26,7 +25,8 @@ test_expect_success 'prepare work tree' '\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":"552249","messageId":"20260908-modernize-t4001-v1-3-cab3933a173f@fastmail.com","threadId":"66297","inReplyTo":"20260908-modernize-t4001-v1-0-cab3933a173f@fastmail.com","subject":"[PATCH 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-08T19:44:55Z","receivedAt":"2026-09-08T19:45:02Z","isPatch":true,"body":"From: \"Mark C. Chu-Carroll\" <markchucarroll@fastmail.com>\n\n---\n t/t4010-diff-pathspec.sh | 78 ++++++++++++++++++++++++------------------------\n 1 file changed, 39 insertions(+), 39 deletions(-)\n\ndiff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh\nindex c84c3fa05b..59e4501203 100755\n--- a/t/t4010-diff-pathspec.sh\n+++ b/t/t4010-diff-pathspec.sh\n@@ -13,67 +13,67 @@ 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+test_expect_success 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 \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+test_expect_success 'limit to path should show nothing' '\n+    git diff-index --cached $tree -- path >current &&\n+    compare_diff_raw current expected\n+'\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+test_expect_success 'limit to path1 should show path1/file1' '\n+    git diff-index --cached $tree -- path1 >current &&\n+    compare_diff_raw current expected\n+'\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+test_expect_success 'limit to path1/ should show path1/file1' '\n+    git diff-index --cached $tree -- path1/ >current &&\n+    compare_diff_raw current expected\n+'\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+test_expect_success '\"*file1\" should show path1/file1' '\n+    git diff-index --cached $tree -- \"*file1\" >current &&\n+    compare_diff_raw current expected\n+'\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+test_expect_success 'limit to file0 should show file0' '\n+    git diff-index --cached $tree -- file0 >current &&\n+    compare_diff_raw current expected\n+'\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+test_expect_success 'limit to file0/ should emit nothing.' '\n+    git diff-index --cached $tree -- file0/ >current &&\n+    compare_diff_raw current expected\n+'\n \n test_expect_success 'diff-tree pathspec' '\n \ttree2=$(git write-tree) &&\n\n-- \n2.53.0\n\n\n"},{"id":"552261","messageId":"xmqqpkynv599.fsf@gitster.g","threadId":"66297","inReplyTo":"20260908-modernize-t4001-v1-1-cab3933a173f@fastmail.com","subject":"Re: [PATCH 1/3] Update t4001 to use modern syntax.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-09-08T20:48:34Z","receivedAt":"2026-09-08T20:48:36Z","isPatch":true,"body":"\"Mark C. Chu-Carroll via B4 Relay\"\n<devnull+markchucarroll.fastmail.com@kernel.org> writes:\n\n> Subject: Re: [PATCH 1/3] Update t4001 to use modern syntax.\n\nDocumentation/SubmittingPatches::[[describe-changes]]\nDocumentation/SubmittingPatches::[[summary-section]]\n\n> From: \"Mark C. Chu-Carroll\" <markchucarroll@fastmail.com>\n>\n> ---\n\nDocumentation/SubmittingPatches::[[sign-off]]\n\n>  t/t4001-diff-rename.sh   | 31 ++++++++++++++++---------------\n>  t/t4009-diff-rename-4.sh |  8 ++++----\n>  2 files changed, 20 insertions(+), 19 deletions(-)\n>\n> diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh\n> index ad474100af..2aa161c217 100755\n> --- a/t/t4001-diff-rename.sh\n> +++ b/t/t4001-diff-rename.sh\n> @@ -88,28 +88,29 @@ test_expect_success 'setup' '\n>  \tEOF\n>  '\n\nThere are a bit more in the differences between this ancient style\nand the modern style.  Not just the title appearing on the first line\nand the body is opened with a single quote at the end of the first\nline, the body is indented with a single tab.\n\n>  \n> -test_expect_success \\\n> -    'update-index --add a file.' \\\n> -    'git update-index --add path0'\n> +test_expect_success 'update-index --add a file.' '\n> +    git update-index --add path0\n> +'\n\nAlso in \"modern style\", the tests are split at more logical\nboundaries.  As the topic of this test is \"diff rename\", our purpose\nof this test script is not to catch a crashing \"update-index --add\".\nWe are not interested in finding \"update-index --add\" to fail and\nsee \"not ok\" for such a failure.  This step is merely the first step\nof building the tree object to be compared later with a modified\nindex.\n\n> -test_expect_success \\\n> -    'write that tree.' \\\n> -    'tree=$(git write-tree) && echo $tree'\n> +test_expect_success 'write that tree.' '\n> +    tree=$(git write-tree) && echo $tree\n> +'\n\nLikewise, we are not interested to find out what object name the\nresulting tree object gets.  \"echo\" here were placed long ago merely\nfor debugging purposes.\n\n>  sed -e 's/line/Line/' <path0 >path1\n>  rm -f path0\n\nAnd in \"modern style\" tests, we strongly frown upon tests doing\nanything outside test_expect_success blocks.  This is a preparation\nto pretend that path0 was \"renamed\" to path1, and it is concluded ...\n\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> +test_expect_success 'renamed and edited the file.' '\n> +    git update-index --add --remove path0 path1\n> +'\n\n... with this step.\n\n> +test_expect_success 'git diff-index -p -M after rename and editing.' '\n> +    git diff-index -p -M $tree >current\n> +'\n\nAnd the output is obtained.  Again, it is not like we are happy that\nthis \"diff-index\" does not crash, so in \"modern style\", we do not\nsplit a logically test like this at this point.  We want to see the\ncommand produce, without segfaulting, its output to the file \"current\",\nand we also want to see that the result matches what we expect.\n\n> -test_expect_success \\\n> -    'validate the output.' \\\n> -    'compare_diff_patch current expected'\n> +test_expect_success 'validate the output.' '\n> +    compare_diff_patch current expected\n> +'\n\nIn addition, in \"modern\" style, it is more common to name the file\nthat the actual output goes \"actual\", and the file that has the\nexpected contents \"expect\", and compare \"expect\" with \"actual\".\nThis test has compared contents in two files with wrong names, and\ncompares them in a wrong order.\n\nTaking all together, it would look more like this, I would imagine.\nOf course as \"expected\" has been renamed to \"expect\" in the initial\nset-up part, the fallouts in the remainder of the test script also\nneeds to be dealt with, which is left as an exercise to the reader.\n\n t/t4001-diff-rename.sh | 31 +++++++++++--------------------\n 1 file changed, 11 insertions(+), 20 deletions(-)\n\ndiff --git c/t/t4001-diff-rename.sh w/t/t4001-diff-rename.sh\nindex ad474100af..61d651d1db 100755\n--- c/t/t4001-diff-rename.sh\n+++ w/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@@ -88,28 +88,19 @@ test_expect_success 'setup' '\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+test_expect_success 'path0 renamed to path1 with minor edit' '\n+\tgit update-index --add path0 &&\n+\ttree=$(git write-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+\t# edit and rename\n+\tsed -e 's/line/Line/' <path0 >path1 &&\n+\trm -f path0 &&\n+\tgit 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+\tgit diff-index -p -M $tree >actual &&\n \n-\n-test_expect_success \\\n-    'validate the output.' \\\n-    'compare_diff_patch current expected'\n+\tcompare_diff_patch expect actual\n+'\n \n test_expect_success 'test diff.renames=true' '\n \tgit -c diff.renames=true diff --cached $tree >current &&\n"}]}