{"thread":{"id":"65355","subject":"Github Patch","startedAt":"2026-03-26T00:15:32Z","lastAt":"2026-05-12T20:02:03Z","messageCount":17,"participants":["Zakariyah Ali","Pablo","Junio C Hamano","Tian Yuchen","Karthik Nayak"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"540031","messageId":"CAPAKoce5BeXMPtok+dni+WDTkokCAq0o4uMHGg1KZto9-UniXQ@mail.gmail.com","threadId":"65355","inReplyTo":null,"subject":"Github Patch","fromName":"Zakariyah Ali","fromEmail":"zakariyahali100@gmail.com","sentAt":"2026-03-26T00:15:20Z","receivedAt":"2026-03-26T00:15:32Z","isPatch":false,"body":"\n\n\nFrom 91a3ccf496cdb61149e3c031265fe252c6c8ef3c Mon Sep 17 00:00:00 2001\nFrom: alibaba0010 <zakariyahali100@gmail.com>\nDate: Tue, 24 Mar 2026 21:04:38 +0100\nSubject: [PATCH] t/t2000: modernize path checks to use test_path helpers\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n\nReplace old-style path checks using `test -f`, `test -d`,\nand `test ! -h` with dedicated test helper functions for\nimproved test clarity and consistency.\n\nThis modernization improves test script readability by using\nGit's dedicated test helpers:\n- `test -f` → `test_path_is_file`\n- `test -d` → `test_path_is_dir`\n- `test ! -h && test -f` →\n  `test_path_is_file_not_symlink`\n- `test ! -h && test -d` →\n  `test_path_is_dir_not_symlink`\n\nFound instances using:\n  git grep 'test -[efd]' t/ | grep 'test -[efd].*&&'\n\nConverted 5 instances in\nt/t2000-conflict-when-checking-files-out.sh\n\nSigned-off-by: alibaba0010 <zakariyahali100@gmail.com>\n---\n t/t2000-conflict-when-checking-files-out.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh\nindex f18616ad2b..b535bb002a 100755\n--- a/t/t2000-conflict-when-checking-files-out.sh\n+++ b/t/t2000-conflict-when-checking-files-out.sh\n@@ -58,7 +58,7 @@ test_expect_success \\\n \n test_expect_success \\\n     'git checkout-index conflicting paths.' \\\n-    'test -f path0 && test -d path1 && test -f path1/file1'\n+    'test_path_is_file path0 && test_path_is_dir path1 && test_path_is_file path1/file1'\n \n test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n \tmkdir -p tar/get &&\n@@ -127,9 +127,9 @@ test_debug 'show_files $tree2'\n \n test_expect_success \\\n     'checking out conflicting path with -f' \\\n-    'test ! -h path2 && test -d path2 &&\n-     test ! -h path3 && test -d path3 &&\n-     test ! -h path2/file0 && test -f path2/file0 &&\n-     test ! -h path3/file1 && test -f path3/file1'\n+    'test_path_is_dir_not_symlink path2 &&\n+     test_path_is_dir_not_symlink path3 &&\n+     test_path_is_file_not_symlink path2/file0 &&\n+     test_path_is_file_not_symlink path3/file1'\n \n test_done\n-- \n2.43.0\n\n"},{"id":"540032","messageId":"CAN5EUNR2yh+OhZ-JtW-dcAFQ3k_WXyB3SXUsEb9FLReuRsMLow@mail.gmail.com","threadId":"65355","inReplyTo":"CAPAKoce5BeXMPtok+dni+WDTkokCAq0o4uMHGg1KZto9-UniXQ@mail.gmail.com","subject":"Re: Github Patch","fromName":"Pablo","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-03-26T00:54:55Z","receivedAt":"2026-03-26T00:55:13Z","isPatch":false,"body":"Zakariyah Ali (<zakariyahali100@gmail.com>) escribió:\n\nThe mail is empty but for the attached patch.\n\nThe patch should be sent inline in the email body, not as an attachment.\nPlease read Documentation/SubmittingPatches [1] and\nDocumentation/MyFirstContribution [2] about how to send patches.\n\nNow, about the patch:\n\n> From: alibaba0010 <zakariyahali100@gmail.com>\n> Signed-off-by: alibaba0010 <zakariyahali100@gmail.com>\n\nYour email says \"Zakariyah Ali\" but the From and Signed-off-by says\n\"alibaba0010. These should be consistent.\nSee Documentation/SubmittingPatches [1].\n\n \"It is common, but not required, to use some form of your real name.\nWe realize that some contributors are not comfortable doing so or\nprefer to contribute under a pseudonym or preferred name and we can\naccept your patch either way, as long as the name and email you use\nare distinctive, identifying, and not misleading.\"\n\n> Replace old-style path checks using `test -f`, `test -d`,\n> and `test ! -h` with dedicated test helper functions for\n> improved test clarity and consistency.\n>\n> This modernization improves test script readability by using\n> Git's dedicated test helpers: > - `test -f` → `test_path_is_file`\n> - `test -d` → `test_path_is_dir`\n> - `test ! -h && test -f` →\n> `test_path_is_file_not_symlink`\n> - `test ! -h && test -d` →\n> `test_path_is_dir_not_symlink`\n\nTry explaining why have you done this, why are these helpers better\nthan what was before rather than clarity and consistency, what do\nthese new helpers do to be considered valuable to refactor it.\n\n> Found instances using: > git grep 'test -[efd]' t/ | grep 'test -[efd].*&&'\n\nEven though it is mentioned on the microprojects to mention what have\nyou used to find the file, because it is only one file, including the\nsearch command is not very useful. Drop it.\n\nGiven the date and that this seems a microproject I guess this is for\nGSoC, you should add to the subject [GSoC PATCH] and CC your possible\nco mentors.\n\nI encourage you the same that it's being encourage for newcomers, read:\n\n      https://lore.kernel.org/git/\n\nThere you'll find other microprojects similar to yours where you can learn from.\n\nCode seems OK.\n\n[1]: https://github.com/git/git/blob/master/Documentation/SubmittingPatches\n[2]: https://github.com/git/git/blob/master/Documentation/MyFirstContribution.adoc\n"},{"id":"540131","messageId":"20260326192603.23961-1-zakariyahali100@gmail.com","threadId":"65355","inReplyTo":"CAPAKoce5BeXMPtok+dni+WDTkokCAq0o4uMHGg1KZto9-UniXQ@mail.gmail.com","subject":"[GSoC PATCH v2] t2000: modernize path checks with test_path_is_* helpers","fromName":"Zakariyah Ali","fromEmail":"zakariyahali100@gmail.com","sentAt":"2026-03-26T19:26:03Z","receivedAt":"2026-03-26T19:26:27Z","isPatch":true,"body":"Replace bare 'test -f/-d' and 'test ! -h' assertions with dedicated\nhelpers. These helpers report loudly what expectation wasn't met,\ntherefore making debugging easier.\n\nSigned-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n---\n t/t2000-conflict-when-checking-files-out.sh | 12 +++++++-----\n 1 file changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh\nindex f18616ad2b..96bae6c53d 100755\n--- a/t/t2000-conflict-when-checking-files-out.sh\n+++ b/t/t2000-conflict-when-checking-files-out.sh\n@@ -58,7 +58,9 @@ test_expect_success \\\n \n test_expect_success \\\n     'git checkout-index conflicting paths.' \\\n-    'test -f path0 && test -d path1 && test -f path1/file1'\n+    'test_path_is_file path0 &&\n+     test_path_is_dir path1 &&\n+     test_path_is_file path1/file1'\n \n test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n \tmkdir -p tar/get &&\n@@ -127,9 +129,9 @@ test_debug 'show_files $tree2'\n \n test_expect_success \\\n     'checking out conflicting path with -f' \\\n-    'test ! -h path2 && test -d path2 &&\n-     test ! -h path3 && test -d path3 &&\n-     test ! -h path2/file0 && test -f path2/file0 &&\n-     test ! -h path3/file1 && test -f path3/file1'\n+    'test_path_is_dir_not_symlink path2 &&\n+     test_path_is_dir_not_symlink path3 &&\n+     test_path_is_file_not_symlink path2/file0 &&\n+     test_path_is_file_not_symlink path3/file1'\n \n test_done\n-- \n2.43.0\n\n"},{"id":"540135","messageId":"xmqqzf3unxlg.fsf@gitster.g","threadId":"65355","inReplyTo":"20260326192603.23961-1-zakariyahali100@gmail.com","subject":"Re: [GSoC PATCH v2] t2000: modernize path checks with test_path_is_* helpers","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-26T20:29:31Z","receivedAt":"2026-03-26T20:29:34Z","isPatch":true,"body":"Zakariyah Ali <zakariyahali100@gmail.com> writes:\n\n> Replace bare 'test -f/-d' and 'test ! -h' assertions with dedicated\n> helpers. These helpers report loudly what expectation wasn't met,\n> therefore making debugging easier.\n>\n> Signed-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n> ---\n>  t/t2000-conflict-when-checking-files-out.sh | 12 +++++++-----\n>  1 file changed, 7 insertions(+), 5 deletions(-)\n\nThere is nothing in the patch text or in the proposed log message\nthat is wrong per-se, but looking at the entire test script, it\nneeds a major clean-up to match the modern testing standard.\n\nOn top of the patch we see here, we may want to do a follow-up patch\nseries to clean them.\n\nHere is how such a patch may start out.  I think the remainder of\nthe file needs to be cleaned up similarly with about the same amount\nof work.\n\n---- >8 ----\nSubject: t2000: modernise overall structure\n\nThis test script that dates back to 2005 certainly shows its age and\nboth its style and the way the tests are laid out do not match the\nmodern standard.\n\n * Executables that prepare the data used to test the command\n   should be inside the test_expect_success block in modern tests.\n\n * In modern tests, running a command that is being tested, making\n   sure it succeeds, and inspecting other side effects that are\n   expected, are all done in a single test_expect_success block.\n\n * A test_expect_success block in modern tests are laid out as\n\n\ttest_expect_success 'title of the test' '\n\t\tbody of the test &&\n\t\t...\n\t\tbody of the test\n\t'\n\n   not as\n\n\ttest_expect_success \\\n\t\t'title of the test' \\\n                'body of the test &&\n\t\t...\n\t\tbody of the test'\n\n   which is in a prehistoric style.\n\n * In modern tests, each &&-chained statement in the body of the\n   test_expect_success block are indented with a horizontal tab,\n   unlike prehistoric style that used 4-space indent.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t2000-conflict-when-checking-files-out.sh | 43 ++++++++++++++---------------\n 1 file changed, 21 insertions(+), 22 deletions(-)\n\ndiff --git c/t/t2000-conflict-when-checking-files-out.sh w/t/t2000-conflict-when-checking-files-out.sh\nindex 96bae6c53d..39c80e80ea 100755\n--- c/t/t2000-conflict-when-checking-files-out.sh\n+++ w/t/t2000-conflict-when-checking-files-out.sh\n@@ -35,32 +35,31 @@ show_files() {\n \tsed -e 's/^\\([0-9]*\\)\t[^ ]*\t[0-9a-f]*\t/tr: \\1 /'\n }\n \n-date >path0\n-mkdir path1\n-date >path1/file1\n+test_expect_success 'prepare files path0 and path1/file1' '\n+\tdate >path0 &&\n+\tmkdir path1 &&\n+\tdate >path1/file1 &&\n \n-test_expect_success \\\n-    'git update-index --add various paths.' \\\n-    'git update-index --add path0 path1/file1'\n-\n-rm -fr path0 path1\n-mkdir path0\n-date >path0/file0\n-date >path1\n+\tgit update-index --add path0 path1/file1\n+'\n \n-test_expect_success \\\n-    'git checkout-index without -f should fail on conflicting work tree.' \\\n-    'test_must_fail git checkout-index -a'\n+test_expect_success 'prepare working tree files with D/F conflicts' '\n+\trm -fr path0 path1 &&\n+\tmkdir path0 &&\n+\tdate >path0/file0 &&\n+\tdate >path1\n+'\n \n-test_expect_success \\\n-    'git checkout-index with -f should succeed.' \\\n-    'git checkout-index -f -a'\n+test_expect_success 'git checkout-index without -f should fail on conflicting work tree.' '\n+\ttest_must_fail git checkout-index -a\n+'\n \n-test_expect_success \\\n-    'git checkout-index conflicting paths.' \\\n-    'test_path_is_file path0 &&\n-     test_path_is_dir path1 &&\n-     test_path_is_file path1/file1'\n+test_expect_success 'git checkout-index with -f should succeed.' '\n+\tgit checkout-index -f -a &&\n+\ttest_path_is_file path0 &&\n+\ttest_path_is_dir path1 &&\n+\ttest_path_is_file path1/file1\n+'\n \n test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n \tmkdir -p tar/get &&\n\n"},{"id":"540246","messageId":"20260327234019.95591-1-zakariyahali100@gmail.com","threadId":"65355","inReplyTo":"20260326192603.23961-1-zakariyahali100@gmail.com","subject":"[GSoC][PATCH v3] t2000: modernise overall structure","fromName":"Zakariyah Ali","fromEmail":"zakariyahali100@gmail.com","sentAt":"2026-03-27T23:40:19Z","receivedAt":"2026-03-27T23:40:39Z","isPatch":true,"body":"This test script that dates back to 2005 certainly shows its age and\nboth its style and the way the tests are laid out do not match the\nmodern standard.\n\n * Executables that prepare the data used to test the command should\n   be inside the test_expect_success block in modern tests.\n\n * In modern tests, running a command that is being tested, making\n   sure it succeeds, and inspecting other side effects that are\n   expected, are all done in a single test_expect_success block.\n\n * A test_expect_success block in modern tests are laid out as\n\n        test_expect_success 'title of the test' '\n                body of the test &&\n                ...\n                body of the test\n        '\n\n   not as\n\n        test_expect_success \\\n                'title of the test' \\\n                'body of the test &&\n                ...\n                body of the test'\n\n   which is in a prehistoric style.\n\n * In modern tests, each &&-chained statement in the body of the\n   test_expect_success block are indented with a horizontal tab,\n   unlike prehistoric style that used 4-space indent.\n\nSigned-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n---\n t/t2000-conflict-when-checking-files-out.sh | 122 +++++++++++---------\n 1 file changed, 66 insertions(+), 56 deletions(-)\n\ndiff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh\nindex f18616ad2b..af199d8191 100755\n--- a/t/t2000-conflict-when-checking-files-out.sh\n+++ b/t/t2000-conflict-when-checking-files-out.sh\n@@ -35,30 +35,30 @@ show_files() {\n \tsed -e 's/^\\([0-9]*\\)\t[^ ]*\t[0-9a-f]*\t/tr: \\1 /'\n }\n \n-date >path0\n-mkdir path1\n-date >path1/file1\n-\n-test_expect_success \\\n-    'git update-index --add various paths.' \\\n-    'git update-index --add path0 path1/file1'\n-\n-rm -fr path0 path1\n-mkdir path0\n-date >path0/file0\n-date >path1\n+test_expect_success 'prepare files path0 and path1/file1' '\n+\tdate >path0 &&\n+\tmkdir path1 &&\n+\tdate >path1/file1 &&\n+\tgit update-index --add path0 path1/file1\n+'\n \n-test_expect_success \\\n-    'git checkout-index without -f should fail on conflicting work tree.' \\\n-    'test_must_fail git checkout-index -a'\n+test_expect_success 'prepare working tree files with D/F conflicts' '\n+\trm -fr path0 path1 &&\n+\tmkdir path0 &&\n+\tdate >path0/file0 &&\n+\tdate >path1\n+'\n \n-test_expect_success \\\n-    'git checkout-index with -f should succeed.' \\\n-    'git checkout-index -f -a'\n+test_expect_success 'git checkout-index without -f should fail on conflicting work tree.' '\n+\ttest_must_fail git checkout-index -a\n+'\n \n-test_expect_success \\\n-    'git checkout-index conflicting paths.' \\\n-    'test -f path0 && test -d path1 && test -f path1/file1'\n+test_expect_success 'git checkout-index with -f should succeed.' '\n+\tgit checkout-index -f -a &&\n+\ttest_path_is_file path0 &&\n+\ttest_path_is_dir path1 &&\n+\ttest_path_is_file path1/file1\n+'\n \n test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n \tmkdir -p tar/get &&\n@@ -83,53 +83,63 @@ test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n # path path3 is occupied by a non-directory.  With \"-f\" it should remove\n # the symlink path3 and create directory path3 and file path3/file1.\n \n-mkdir path2\n-date >path2/file0\n-test_expect_success \\\n-    'git update-index --add path2/file0' \\\n-    'git update-index --add path2/file0'\n-test_expect_success \\\n-    'writing tree out with git write-tree' \\\n-    'tree1=$(git write-tree)'\n+test_expect_success 'prepare path2/file0 and index' '\n+\tmkdir path2 &&\n+\tdate >path2/file0 &&\n+\tgit update-index --add path2/file0\n+'\n+\n+test_expect_success 'write tree with path2/file0' '\n+\ttree1=$(git write-tree)\n+'\n+\n test_debug 'show_files $tree1'\n \n-mkdir path3\n-date >path3/file1\n-test_expect_success \\\n-    'git update-index --add path3/file1' \\\n-    'git update-index --add path3/file1'\n-test_expect_success \\\n-    'writing tree out with git write-tree' \\\n-    'tree2=$(git write-tree)'\n+test_expect_success 'prepare path3/file1 and index' '\n+\tmkdir path3 &&\n+\tdate >path3/file1 &&\n+\tgit update-index --add path3/file1\n+'\n+\n+test_expect_success 'write tree with path3/file1' '\n+\ttree2=$(git write-tree)\n+'\n+\n test_debug 'show_files $tree2'\n \n-rm -fr path3\n-test_expect_success \\\n-    'read previously written tree and checkout.' \\\n-    'git read-tree -m $tree1 && git checkout-index -f -a'\n+test_expect_success 'read previously written tree and checkout.' '\n+\trm -fr path3 &&\n+\tgit read-tree -m $tree1 &&\n+\tgit checkout-index -f -a\n+'\n+\n test_debug 'show_files $tree1'\n \n-test_expect_success \\\n-    'add a symlink' \\\n-    'test_ln_s_add path2 path3'\n-test_expect_success \\\n-    'writing tree out with git write-tree' \\\n-    'tree3=$(git write-tree)'\n+test_expect_success 'add a symlink' '\n+\ttest_ln_s_add path2 path3\n+'\n+\n+test_expect_success 'write tree with symlink path3' '\n+\ttree3=$(git write-tree)\n+'\n+\n test_debug 'show_files $tree3'\n \n # Morten says \"Got that?\" here.\n # Test begins.\n \n-test_expect_success \\\n-    'read previously written tree and checkout.' \\\n-    'git read-tree $tree2 && git checkout-index -f -a'\n+test_expect_success 'read previously written tree and checkout.' '\n+\tgit read-tree $tree2 &&\n+\tgit checkout-index -f -a\n+'\n+\n test_debug 'show_files $tree2'\n \n-test_expect_success \\\n-    'checking out conflicting path with -f' \\\n-    'test ! -h path2 && test -d path2 &&\n-     test ! -h path3 && test -d path3 &&\n-     test ! -h path2/file0 && test -f path2/file0 &&\n-     test ! -h path3/file1 && test -f path3/file1'\n+test_expect_success 'checking out conflicting path with -f' '\n+\ttest_path_is_dir_not_symlink path2 &&\n+\ttest_path_is_dir_not_symlink path3 &&\n+\ttest_path_is_file_not_symlink path2/file0 &&\n+\ttest_path_is_file_not_symlink path3/file1\n+'\n \n test_done\n-- \n2.43.0\n\n"},{"id":"540367","messageId":"20260330123130.40959-1-zakariyahali100@gmail.com","threadId":"65355","inReplyTo":"20260327234019.95591-1-zakariyahali100@gmail.com","subject":"Re: [GSoC][PATCH v3] t2000: modernise overall structure","fromName":"Zakariyah Ali","fromEmail":"zakariyahali100@gmail.com","sentAt":"2026-03-30T12:31:29Z","receivedAt":"2026-03-30T12:31:55Z","isPatch":true,"body":"Hi everyone,\n\nJust a gentle reminder on this v3 patch. I would be looking forward for your review.\n\nThanks,\nZakariyah\n"},{"id":"540655","messageId":"0c2ee025-3fe3-4f8f-b8ea-62d2f101c15d@gmail.com","threadId":"65355","inReplyTo":"20260327234019.95591-1-zakariyahali100@gmail.com","subject":"Re: [GSoC][PATCH v3] t2000: modernise overall structure","fromName":"Tian Yuchen","fromEmail":"a3205153416@gmail.com","sentAt":"2026-04-01T17:09:56Z","receivedAt":"2026-04-01T17:10:02Z","isPatch":true,"body":"On 3/28/26 07:40, Zakariyah Ali wrote:\n> This test script that dates back to 2005 certainly shows its age and\n> both its style and the way the tests are laid out do not match the\n> modern standard.\n> \n>   * Executables that prepare the data used to test the command should\n>     be inside the test_expect_success block in modern tests.\n> \n>   * In modern tests, running a command that is being tested, making\n>     sure it succeeds, and inspecting other side effects that are\n>     expected, are all done in a single test_expect_success block.\n> \n>   * A test_expect_success block in modern tests are laid out as\n> \n>          test_expect_success 'title of the test' '\n>                  body of the test &&\n>                  ...\n>                  body of the test\n>          '\n> \n>     not as\n> \n>          test_expect_success \\\n>                  'title of the test' \\\n>                  'body of the test &&\n>                  ...\n>                  body of the test'\n> \n>     which is in a prehistoric style.\n> \n>   * In modern tests, each &&-chained statement in the body of the\n>     test_expect_success block are indented with a horizontal tab,\n>     unlike prehistoric style that used 4-space indent.\n\nI like this commit message. Nice.\n\nWould it be better to add a 'Helped-by'?\n\n> Signed-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n> ---\n>   t/t2000-conflict-when-checking-files-out.sh | 122 +++++++++++---------\n>   1 file changed, 66 insertions(+), 56 deletions(-)\n> \n> diff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh\n> index f18616ad2b..af199d8191 100755\n> --- a/t/t2000-conflict-when-checking-files-out.sh\n> +++ b/t/t2000-conflict-when-checking-files-out.sh\n> @@ -35,30 +35,30 @@ show_files() {\n>   \tsed -e 's/^\\([0-9]*\\)\t[^ ]*\t[0-9a-f]*\t/tr: \\1 /'\n>   }\n>   \n> -date >path0\n> -mkdir path1\n> -date >path1/file1\n> -\n> -test_expect_success \\\n> -    'git update-index --add various paths.' \\\n> -    'git update-index --add path0 path1/file1'\n> -\n> -rm -fr path0 path1\n> -mkdir path0\n> -date >path0/file0\n> -date >path1\n> +test_expect_success 'prepare files path0 and path1/file1' '\n> +\tdate >path0 &&\n> +\tmkdir path1 &&\n> +\tdate >path1/file1 &&\n> +\tgit update-index --add path0 path1/file1\n> +'\n>   \n> -test_expect_success \\\n> -    'git checkout-index without -f should fail on conflicting work tree.' \\\n> -    'test_must_fail git checkout-index -a'\n> +test_expect_success 'prepare working tree files with D/F conflicts' '\n> +\trm -fr path0 path1 &&\n> +\tmkdir path0 &&\n> +\tdate >path0/file0 &&\n> +\tdate >path1\n> +'\n>   \n> -test_expect_success \\\n> -    'git checkout-index with -f should succeed.' \\\n> -    'git checkout-index -f -a'\n> +test_expect_success 'git checkout-index without -f should fail on conflicting work tree.' '\n> +\ttest_must_fail git checkout-index -a\n> +'\n>   \n> -test_expect_success \\\n> -    'git checkout-index conflicting paths.' \\\n> -    'test -f path0 && test -d path1 && test -f path1/file1'\n> +test_expect_success 'git checkout-index with -f should succeed.' '\n> +\tgit checkout-index -f -a &&\n> +\ttest_path_is_file path0 &&\n> +\ttest_path_is_dir path1 &&\n> +\ttest_path_is_file path1/file1\n> +'\n>   \n>   test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n>   \tmkdir -p tar/get &&\n> @@ -83,53 +83,63 @@ test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n>   # path path3 is occupied by a non-directory.  With \"-f\" it should remove\n>   # the symlink path3 and create directory path3 and file path3/file1.\n>   \n> -mkdir path2\n> -date >path2/file0\n> -test_expect_success \\\n> -    'git update-index --add path2/file0' \\\n> -    'git update-index --add path2/file0'\n> -test_expect_success \\\n> -    'writing tree out with git write-tree' \\\n> -    'tree1=$(git write-tree)'\n> +test_expect_success 'prepare path2/file0 and index' '\n> +\tmkdir path2 &&\n> +\tdate >path2/file0 &&\n> +\tgit update-index --add path2/file0\n> +'\n> +\n> +test_expect_success 'write tree with path2/file0' '\n> +\ttree1=$(git write-tree)\n> +'\n> +\n>   test_debug 'show_files $tree1'\n>   \n> -mkdir path3\n> -date >path3/file1\n> -test_expect_success \\\n> -    'git update-index --add path3/file1' \\\n> -    'git update-index --add path3/file1'\n> -test_expect_success \\\n> -    'writing tree out with git write-tree' \\\n> -    'tree2=$(git write-tree)'\n> +test_expect_success 'prepare path3/file1 and index' '\n> +\tmkdir path3 &&\n> +\tdate >path3/file1 &&\n> +\tgit update-index --add path3/file1\n> +'\n> +\n> +test_expect_success 'write tree with path3/file1' '\n> +\ttree2=$(git write-tree)\n> +'\n> +\n>   test_debug 'show_files $tree2'\n>   \n> -rm -fr path3\n> -test_expect_success \\\n> -    'read previously written tree and checkout.' \\\n> -    'git read-tree -m $tree1 && git checkout-index -f -a'\n> +test_expect_success 'read previously written tree and checkout.' '\n> +\trm -fr path3 &&\n> +\tgit read-tree -m $tree1 &&\n> +\tgit checkout-index -f -a\n> +'\n> +\n>   test_debug 'show_files $tree1'\n>   \n> -test_expect_success \\\n> -    'add a symlink' \\\n> -    'test_ln_s_add path2 path3'\n> -test_expect_success \\\n> -    'writing tree out with git write-tree' \\\n> -    'tree3=$(git write-tree)'\n> +test_expect_success 'add a symlink' '\n> +\ttest_ln_s_add path2 path3\n> +'\n> +\n> +test_expect_success 'write tree with symlink path3' '\n> +\ttree3=$(git write-tree)\n> +'\n> +\n>   test_debug 'show_files $tree3'\n>   \n>   # Morten says \"Got that?\" here.\n>   # Test begins.\n>   \n> -test_expect_success \\\n> -    'read previously written tree and checkout.' \\\n> -    'git read-tree $tree2 && git checkout-index -f -a'\n> +test_expect_success 'read previously written tree and checkout.' '\n> +\tgit read-tree $tree2 &&\n> +\tgit checkout-index -f -a\n> +'\n> +\n>   test_debug 'show_files $tree2'\n>   \n> -test_expect_success \\\n> -    'checking out conflicting path with -f' \\\n> -    'test ! -h path2 && test -d path2 &&\n> -     test ! -h path3 && test -d path3 &&\n> -     test ! -h path2/file0 && test -f path2/file0 &&\n> -     test ! -h path3/file1 && test -f path3/file1'\n> +test_expect_success 'checking out conflicting path with -f' '\n> +\ttest_path_is_dir_not_symlink path2 &&\n> +\ttest_path_is_dir_not_symlink path3 &&\n> +\ttest_path_is_file_not_symlink path2/file0 &&\n> +\ttest_path_is_file_not_symlink path3/file1\n> +'\n\ntest_path_is_file_not_symlink and test_path_is_dir_not_symlink look \nrather unfamiliar, and sure enough, only four test scripts in the Git \ntest suite make use of them.\n\nThese two functions were implemented four years ago; the commit hash is \n456296b5d1f05ca16949e7d37ae87f5750118564. Although the names of these \ntwo functions are particularly simple and straightforward, I’m not sure \nif it would be better to mention them in the commit message.\n\n>   \n>   test_done\n\nThanks, Yuchen\n"},{"id":"540937","messageId":"20260405011135.125912-1-zakariyahali100@gmail.com","threadId":"65355","inReplyTo":"20260327234019.95591-1-zakariyahali100@gmail.com","subject":"[PATCH v4 1/1] t2000: modernize overall structure and path checks","fromName":"Zakariyah Ali","fromEmail":"zakariyahali100@gmail.com","sentAt":"2026-04-05T01:11:34Z","receivedAt":"2026-04-05T01:11:57Z","isPatch":true,"body":"This test script that dates back to 2005 certainly shows its age and\nboth its style and the way the tests are laid out do not match the\nmodern standard. Modernize it to match the current testing standards:\n\n  * Executables that prepare the data used to test the command should\n    be inside the test_expect_success block in modern tests.\n\n  * In modern tests, running a command that is being tested, making\n    sure it succeeds, and inspecting other side effects that are\n    expected, are all done in a single test_expect_success block.\n\n  * A test_expect_success block in modern tests are laid out as\n\n         test_expect_success 'title of the test' '\n                 body of the test &&\n                 ...\n                 body of the test\n         '\n\n    not as\n\n         test_expect_success \\\n                 'title of the test' \\\n                 'body of the test &&\n                 ...\n                 body of the test'\n\n    which is in a prehistoric style.\n\n  * In modern tests, each &&-chained statement in the body of the\n    test_expect_success block are indented with a horizontal tab,\n    unlike prehistoric style that used 4-space indent.\n\n  * Replace bare 'test -f/-d' and 'test ! -h' assertions with dedicated\n    test_path_is_* helpers (specifically test_path_is_file_not_symlink and\n    test_path_is_dir_not_symlink). While less commonly used in the test\n    suite than test_path_is_file/dir, they act as direct replacements\n    for the specific checks being performed and provide clearer\n    diagnostics on failure.\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n---\nHi Yuchen,\n\nThanks for the review. Regarding test_path_is_file_not_symlink and test_path_is_dir_not_symlink, I used them as direct replacements for the existing pattern: `test ! -h <path> && test -f/-d <path>`. As you noted, they are simple and straightforward. Following your suggestion, I've added a note about them to the commit message in this v4 patch.\n\nI have also added the 'Helped-by' trailer as suggested, since the commit message structure was provided by Junio C Hamano.\n\nAlso, a quick question please: since the GSoC proposal period for 2026 has closed, could you guide me on the next steps for applying to subsequent related internships (like Outreachy, if applicable)? I would love to know how I can best continue contributing to Git in the meantime.\n\nRegards,\nZakariyah Ali.\n\n t/t2000-conflict-when-checking-files-out.sh | 99 +++++++++++----------\n 1 file changed, 54 insertions(+), 45 deletions(-)\n\ndiff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh\nindex f18616ad2b..a8a49df93e 100755\n--- a/t/t2000-conflict-when-checking-files-out.sh\n+++ b/t/t2000-conflict-when-checking-files-out.sh\n@@ -48,17 +48,16 @@ mkdir path0\n date >path0/file0\n date >path1\n \n-test_expect_success \\\n-    'git checkout-index without -f should fail on conflicting work tree.' \\\n-    'test_must_fail git checkout-index -a'\n-\n-test_expect_success \\\n-    'git checkout-index with -f should succeed.' \\\n-    'git checkout-index -f -a'\n+test_expect_success 'git checkout-index without -f should fail on conflicting work tree.' '\n+\ttest_must_fail git checkout-index -a\n+'\n \n-test_expect_success \\\n-    'git checkout-index conflicting paths.' \\\n-    'test -f path0 && test -d path1 && test -f path1/file1'\n+test_expect_success 'git checkout-index with -f should succeed.' '\n+\tgit checkout-index -f -a &&\n+\ttest_path_is_file path0 &&\n+\ttest_path_is_dir path1 &&\n+\ttest_path_is_file path1/file1\n+'\n \n test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n \tmkdir -p tar/get &&\n@@ -83,53 +82,63 @@ test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n # path path3 is occupied by a non-directory.  With \"-f\" it should remove\n # the symlink path3 and create directory path3 and file path3/file1.\n \n-mkdir path2\n-date >path2/file0\n-test_expect_success \\\n-    'git update-index --add path2/file0' \\\n-    'git update-index --add path2/file0'\n-test_expect_success \\\n-    'writing tree out with git write-tree' \\\n-    'tree1=$(git write-tree)'\n+test_expect_success 'prepare path2/file0 and index' '\n+\tmkdir path2 &&\n+\tdate >path2/file0 &&\n+\tgit update-index --add path2/file0\n+'\n+\n+test_expect_success 'write tree with path2/file0' '\n+\ttree1=$(git write-tree)\n+'\n+\n test_debug 'show_files $tree1'\n \n-mkdir path3\n-date >path3/file1\n-test_expect_success \\\n-    'git update-index --add path3/file1' \\\n-    'git update-index --add path3/file1'\n-test_expect_success \\\n-    'writing tree out with git write-tree' \\\n-    'tree2=$(git write-tree)'\n+test_expect_success 'prepare path3/file1 and index' '\n+\tmkdir path3 &&\n+\tdate >path3/file1 &&\n+\tgit update-index --add path3/file1\n+'\n+\n+test_expect_success 'write tree with path3/file1' '\n+\ttree2=$(git write-tree)\n+'\n+\n test_debug 'show_files $tree2'\n \n-rm -fr path3\n-test_expect_success \\\n-    'read previously written tree and checkout.' \\\n-    'git read-tree -m $tree1 && git checkout-index -f -a'\n+test_expect_success 'read previously written tree and checkout.' '\n+\trm -fr path3 &&\n+\tgit read-tree -m $tree1 &&\n+\tgit checkout-index -f -a\n+'\n+\n test_debug 'show_files $tree1'\n \n-test_expect_success \\\n-    'add a symlink' \\\n-    'test_ln_s_add path2 path3'\n-test_expect_success \\\n-    'writing tree out with git write-tree' \\\n-    'tree3=$(git write-tree)'\n+test_expect_success 'add a symlink' '\n+\ttest_ln_s_add path2 path3\n+'\n+\n+test_expect_success 'write tree with symlink path3' '\n+\ttree3=$(git write-tree)\n+'\n+\n test_debug 'show_files $tree3'\n \n # Morten says \"Got that?\" here.\n # Test begins.\n \n-test_expect_success \\\n-    'read previously written tree and checkout.' \\\n-    'git read-tree $tree2 && git checkout-index -f -a'\n+test_expect_success 'read previously written tree and checkout.' '\n+\tgit read-tree $tree2 &&\n+\tgit checkout-index -f -a\n+'\n+\n test_debug 'show_files $tree2'\n \n-test_expect_success \\\n-    'checking out conflicting path with -f' \\\n-    'test ! -h path2 && test -d path2 &&\n-     test ! -h path3 && test -d path3 &&\n-     test ! -h path2/file0 && test -f path2/file0 &&\n-     test ! -h path3/file1 && test -f path3/file1'\n+test_expect_success 'checking out conflicting path with -f' '\n+\ttest_path_is_dir_not_symlink path2 &&\n+\ttest_path_is_dir_not_symlink path3 &&\n+\ttest_path_is_file_not_symlink path2/file0 &&\n+\ttest_path_is_file_not_symlink path3/file1\n+'\n \n test_done\n-- \n2.43.0\n\n"},{"id":"540956","messageId":"CAOLa=ZTuk-33xz4RQJDv-nyK-MqFzLWHM7zdmBBGnXjYiJBsSQ@mail.gmail.com","threadId":"65355","inReplyTo":"20260405011135.125912-1-zakariyahali100@gmail.com","subject":"Re: [PATCH v4 1/1] t2000: modernize overall structure and path checks","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-04-05T22:04:07Z","receivedAt":"2026-04-05T22:04:09Z","isPatch":true,"body":"Zakariyah Ali <zakariyahali100@gmail.com> writes:\n\n> This test script that dates back to 2005 certainly shows its age and\n> both its style and the way the tests are laid out do not match the\n> modern standard. Modernize it to match the current testing standards:\n>\n>   * Executables that prepare the data used to test the command should\n>     be inside the test_expect_success block in modern tests.\n>\n>   * In modern tests, running a command that is being tested, making\n>     sure it succeeds, and inspecting other side effects that are\n>     expected, are all done in a single test_expect_success block.\n>\n>   * A test_expect_success block in modern tests are laid out as\n>\n>          test_expect_success 'title of the test' '\n>                  body of the test &&\n>                  ...\n>                  body of the test\n>          '\n>\n>     not as\n>\n>          test_expect_success \\\n>                  'title of the test' \\\n>                  'body of the test &&\n>                  ...\n>                  body of the test'\n>\n>     which is in a prehistoric style.\n>\n>   * In modern tests, each &&-chained statement in the body of the\n>     test_expect_success block are indented with a horizontal tab,\n>     unlike prehistoric style that used 4-space indent.\n>\n>   * Replace bare 'test -f/-d' and 'test ! -h' assertions with dedicated\n>     test_path_is_* helpers (specifically test_path_is_file_not_symlink and\n>     test_path_is_dir_not_symlink). While less commonly used in the test\n>     suite than test_path_is_file/dir, they act as direct replacements\n>     for the specific checks being performed and provide clearer\n>     diagnostics on failure.\n>\n\n> Helped-by: Junio C Hamano <gitster@pobox.com>\n> Signed-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n> ---\n> Hi Yuchen,\n>\n> Thanks for the review. Regarding test_path_is_file_not_symlink and test_path_is_dir_not_symlink, I used them as direct replacements for the existing pattern: `test ! -h <path> && test -f/-d <path>`. As you noted, they are simple and straightforward. Following your suggestion, I've added a note about them to the commit message in this v4 patch.\n>\n> I have also added the 'Helped-by' trailer as suggested, since the commit message structure was provided by Junio C Hamano.\n>\n> Also, a quick question please: since the GSoC proposal period for 2026 has closed, could you guide me on the next steps for applying to subsequent related internships (like Outreachy, if applicable)? I would love to know how I can best continue contributing to Git in the meantime.\n>\n> Regards,\n> Zakariyah Ali.\n>\n>  t/t2000-conflict-when-checking-files-out.sh | 99 +++++++++++----------\n>  1 file changed, 54 insertions(+), 45 deletions(-)\n>\n> diff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh\n> index f18616ad2b..a8a49df93e 100755\n> --- a/t/t2000-conflict-when-checking-files-out.sh\n> +++ b/t/t2000-conflict-when-checking-files-out.sh\n> @@ -48,17 +48,16 @@ mkdir path0\n>  date >path0/file0\n>  date >path1\n>\n> -test_expect_success \\\n> -    'git checkout-index without -f should fail on conflicting work tree.' \\\n> -    'test_must_fail git checkout-index -a'\n> -\n> -test_expect_success \\\n> -    'git checkout-index with -f should succeed.' \\\n> -    'git checkout-index -f -a'\n> +test_expect_success 'git checkout-index without -f should fail on conflicting work tree.' '\n> +\ttest_must_fail git checkout-index -a\n> +'\n>\n\nNot on you, but generally the data setup happens in the same block as\nthe test, in this case we're relying on previously setup data. But this\nis already better than before.\n\n> -test_expect_success \\\n> -    'git checkout-index conflicting paths.' \\\n> -    'test -f path0 && test -d path1 && test -f path1/file1'\n> +test_expect_success 'git checkout-index with -f should succeed.' '\n> +\tgit checkout-index -f -a &&\n> +\ttest_path_is_file path0 &&\n> +\ttest_path_is_dir path1 &&\n> +\ttest_path_is_file path1/file1\n> +'\n>\n\nOkay we combine the two tests which were doing the execution and\nvalidation independently.\n\n>  test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n>  \tmkdir -p tar/get &&\n> @@ -83,53 +82,63 @@ test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n>  # path path3 is occupied by a non-directory.  With \"-f\" it should remove\n>  # the symlink path3 and create directory path3 and file path3/file1.\n>\n> -mkdir path2\n> -date >path2/file0\n> -test_expect_success \\\n> -    'git update-index --add path2/file0' \\\n> -    'git update-index --add path2/file0'\n> -test_expect_success \\\n> -    'writing tree out with git write-tree' \\\n> -    'tree1=$(git write-tree)'\n> +test_expect_success 'prepare path2/file0 and index' '\n> +\tmkdir path2 &&\n> +\tdate >path2/file0 &&\n> +\tgit update-index --add path2/file0\n> +'\n> +\n> +test_expect_success 'write tree with path2/file0' '\n> +\ttree1=$(git write-tree)\n> +'\n> +\n>  test_debug 'show_files $tree1'\n>\n> -mkdir path3\n> -date >path3/file1\n> -test_expect_success \\\n> -    'git update-index --add path3/file1' \\\n> -    'git update-index --add path3/file1'\n> -test_expect_success \\\n> -    'writing tree out with git write-tree' \\\n> -    'tree2=$(git write-tree)'\n> +test_expect_success 'prepare path3/file1 and index' '\n> +\tmkdir path3 &&\n> +\tdate >path3/file1 &&\n> +\tgit update-index --add path3/file1\n> +'\n> +\n> +test_expect_success 'write tree with path3/file1' '\n> +\ttree2=$(git write-tree)\n> +'\n> +\n>  test_debug 'show_files $tree2'\n>\n> -rm -fr path3\n> -test_expect_success \\\n> -    'read previously written tree and checkout.' \\\n> -    'git read-tree -m $tree1 && git checkout-index -f -a'\n> +test_expect_success 'read previously written tree and checkout.' '\n> +\trm -fr path3 &&\n> +\tgit read-tree -m $tree1 &&\n> +\tgit checkout-index -f -a\n> +'\n> +\n>  test_debug 'show_files $tree1'\n>\n> -test_expect_success \\\n> -    'add a symlink' \\\n> -    'test_ln_s_add path2 path3'\n> -test_expect_success \\\n> -    'writing tree out with git write-tree' \\\n> -    'tree3=$(git write-tree)'\n> +test_expect_success 'add a symlink' '\n> +\ttest_ln_s_add path2 path3\n> +'\n> +\n> +test_expect_success 'write tree with symlink path3' '\n> +\ttree3=$(git write-tree)\n> +'\n> +\n>  test_debug 'show_files $tree3'\n>\n>  # Morten says \"Got that?\" here.\n>  # Test begins.\n>\n> -test_expect_success \\\n> -    'read previously written tree and checkout.' \\\n> -    'git read-tree $tree2 && git checkout-index -f -a'\n> +test_expect_success 'read previously written tree and checkout.' '\n> +\tgit read-tree $tree2 &&\n> +\tgit checkout-index -f -a\n> +'\n> +\n>  test_debug 'show_files $tree2'\n>\n> -test_expect_success \\\n> -    'checking out conflicting path with -f' \\\n> -    'test ! -h path2 && test -d path2 &&\n> -     test ! -h path3 && test -d path3 &&\n> -     test ! -h path2/file0 && test -f path2/file0 &&\n> -     test ! -h path3/file1 && test -f path3/file1'\n> +test_expect_success 'checking out conflicting path with -f' '\n> +\ttest_path_is_dir_not_symlink path2 &&\n> +\ttest_path_is_dir_not_symlink path3 &&\n> +\ttest_path_is_file_not_symlink path2/file0 &&\n> +\ttest_path_is_file_not_symlink path3/file1\n> +'\n>\n\nShouldn't all the tests above (since 'mkdir path2') be a single test\nblock? First we setup the data, validate the data, the previous test\nruns 'git-checkout-index' and finally here we're verifying the endstate\nhere. I think this should all fit into one test block.\n\nThanks,\nKarthik\n\n>  test_done\n> --\n> 2.43.0\n"},{"id":"540989","messageId":"9639df15-8498-4dd0-8ea1-6ebaf4533476@malon.dev","threadId":"65355","inReplyTo":"CAOLa=ZTuk-33xz4RQJDv-nyK-MqFzLWHM7zdmBBGnXjYiJBsSQ@mail.gmail.com","subject":"Re: [PATCH v4 1/1] t2000: modernize overall structure and path checks","fromName":"Tian Yuchen","fromEmail":"cat@malon.dev","sentAt":"2026-04-06T17:36:02Z","receivedAt":"2026-04-06T17:36:09Z","isPatch":true,"body":"On 4/6/26 06:04, Karthik Nayak wrote:\n> \n> Shouldn't all the tests above (since 'mkdir path2') be a single test\n> block? First we setup the data, validate the data, the previous test\n> runs 'git-checkout-index' and finally here we're verifying the endstate\n> here. I think this should all fit into one test block.\n\nThat makes sense. I didn’t mention this earlier because I hadn’t noticed \nthat the patch title had changed from 't2000: modernise path checks with \ntest_path_is_* helpers' to 't2000: modernise overall structure'. If this \nis a overall refactor, then it would be worth revising this outdated \ntest structure as well ;)\n\n> \n> Thanks,\n> Karthik\n> \n>>   test_done\n>> --\n>> 2.43.0\n\nRegards, Yuchen\n"},{"id":"541032","messageId":"20260407034446.409175-1-zakariyahali100@gmail.com","threadId":"65355","inReplyTo":"20260405011135.125912-1-zakariyahali100@gmail.com","subject":"[PATCH v5] t2000: modernize overall structure and path checks","fromName":"Zakariyah Ali","fromEmail":"zakariyahali100@gmail.com","sentAt":"2026-04-07T03:44:46Z","receivedAt":"2026-04-07T03:44:58Z","isPatch":true,"body":"This test script that dates back to 2005 certainly shows its age and\nboth its style and the way the tests are laid out do not match the\nmodern standard. Modernize it to match the current testing standards:\n\n  * Executables that prepare the data used to test the command should\n    be inside the test_expect_success block in modern tests.\n\n  * In modern tests, running a command that is being tested, making\n    sure it succeeds, and inspecting other side effects that are\n    expected, are all done in a single test_expect_success block.\n\n  * A test_expect_success block in modern tests are laid out as\n\n         test_expect_success 'title of the test' '\n                 body of the test &&\n                 ...\n                 body of the test\n         '\n\n    not as\n\n         test_expect_success \\\n                 'title of the test' \\\n                 'body of the test &&\n                 ...\n                 body of the test'\n\n    which is in a prehistoric style.\n\n  * In modern tests, each &&-chained statement in the body of the\n    test_expect_success block are indented with a horizontal tab,\n    unlike prehistoric style that used 4-space indent.\n\n  * Replace bare 'test -f/-d' and 'test ! -h' assertions with dedicated\n    test_path_is_* helpers (specifically test_path_is_file_not_symlink and\n    test_path_is_dir_not_symlink). While less commonly used in the test\n    suite than test_path_is_file/dir, they act as direct replacements\n    for the specific checks being performed and provide clearer\n    diagnostics on failure.\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nHelped-by: Karthik Nayak <karthik.188@gmail.com>\nHelped-by: Tian Yuchen <cat@malon.dev>\nSigned-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n---\n t/t2000-conflict-when-checking-files-out.sh | 88 +++++++--------------\n 1 file changed, 30 insertions(+), 58 deletions(-)\n\ndiff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh\nindex f18616ad2b..44728329f3 100755\n--- a/t/t2000-conflict-when-checking-files-out.sh\n+++ b/t/t2000-conflict-when-checking-files-out.sh\n@@ -48,17 +48,16 @@ mkdir path0\n date >path0/file0\n date >path1\n \n-test_expect_success \\\n-    'git checkout-index without -f should fail on conflicting work tree.' \\\n-    'test_must_fail git checkout-index -a'\n-\n-test_expect_success \\\n-    'git checkout-index with -f should succeed.' \\\n-    'git checkout-index -f -a'\n+test_expect_success 'git checkout-index without -f should fail on conflicting work tree.' '\n+\ttest_must_fail git checkout-index -a\n+'\n \n-test_expect_success \\\n-    'git checkout-index conflicting paths.' \\\n-    'test -f path0 && test -d path1 && test -f path1/file1'\n+test_expect_success 'git checkout-index with -f should succeed.' '\n+\tgit checkout-index -f -a &&\n+\ttest_path_is_file path0 &&\n+\ttest_path_is_dir path1 &&\n+\ttest_path_is_file path1/file1\n+'\n \n test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n \tmkdir -p tar/get &&\n@@ -83,53 +82,26 @@ test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n # path path3 is occupied by a non-directory.  With \"-f\" it should remove\n # the symlink path3 and create directory path3 and file path3/file1.\n \n-mkdir path2\n-date >path2/file0\n-test_expect_success \\\n-    'git update-index --add path2/file0' \\\n-    'git update-index --add path2/file0'\n-test_expect_success \\\n-    'writing tree out with git write-tree' \\\n-    'tree1=$(git write-tree)'\n-test_debug 'show_files $tree1'\n-\n-mkdir path3\n-date >path3/file1\n-test_expect_success \\\n-    'git update-index --add path3/file1' \\\n-    'git update-index --add path3/file1'\n-test_expect_success \\\n-    'writing tree out with git write-tree' \\\n-    'tree2=$(git write-tree)'\n-test_debug 'show_files $tree2'\n-\n-rm -fr path3\n-test_expect_success \\\n-    'read previously written tree and checkout.' \\\n-    'git read-tree -m $tree1 && git checkout-index -f -a'\n-test_debug 'show_files $tree1'\n-\n-test_expect_success \\\n-    'add a symlink' \\\n-    'test_ln_s_add path2 path3'\n-test_expect_success \\\n-    'writing tree out with git write-tree' \\\n-    'tree3=$(git write-tree)'\n-test_debug 'show_files $tree3'\n-\n-# Morten says \"Got that?\" here.\n-# Test begins.\n-\n-test_expect_success \\\n-    'read previously written tree and checkout.' \\\n-    'git read-tree $tree2 && git checkout-index -f -a'\n-test_debug 'show_files $tree2'\n-\n-test_expect_success \\\n-    'checking out conflicting path with -f' \\\n-    'test ! -h path2 && test -d path2 &&\n-     test ! -h path3 && test -d path3 &&\n-     test ! -h path2/file0 && test -f path2/file0 &&\n-     test ! -h path3/file1 && test -f path3/file1'\n+test_expect_success 'checkout-index -f resolves symlink conflict on leading path' '\n+\tmkdir path2 &&\n+\tdate >path2/file0 &&\n+\tgit update-index --add path2/file0 &&\n+\ttree1=$(git write-tree) &&\n+\tmkdir path3 &&\n+\tdate >path3/file1 &&\n+\tgit update-index --add path3/file1 &&\n+\ttree2=$(git write-tree) &&\n+\trm -fr path3 &&\n+\tgit read-tree -m $tree1 &&\n+\tgit checkout-index -f -a &&\n+\ttest_ln_s_add path2 path3 &&\n+\ttree3=$(git write-tree) &&\n+\tgit read-tree $tree2 &&\n+\tgit checkout-index -f -a &&\n+\ttest_path_is_dir_not_symlink path2 &&\n+\ttest_path_is_dir_not_symlink path3 &&\n+\ttest_path_is_file_not_symlink path2/file0 &&\n+\ttest_path_is_file_not_symlink path3/file1\n+'\n \n test_done\n-- \n2.43.0\n\n"},{"id":"541066","messageId":"xmqqmrze7sj9.fsf@gitster.g","threadId":"65355","inReplyTo":"20260407034446.409175-1-zakariyahali100@gmail.com","subject":"Re: [PATCH v5] t2000: modernize overall structure and path checks","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-04-07T14:29:30Z","receivedAt":"2026-04-07T14:29:33Z","isPatch":true,"body":"Zakariyah Ali <zakariyahali100@gmail.com> writes:\n\n> This test script that dates back to 2005 certainly shows its age and\n> both its style and the way the tests are laid out do not match the\n> modern standard. Modernize it to match the current testing standards:\n> ...\n\nHow does this relate to d8e34f97 (t2000: modernise overall\nstructure, 2026-03-28) that was merged to 'next' at 279c41a3 (Merge\nbranch 'za/t2000-modernise' into next, 2026-03-31) and is now in\n'master' at 0713d3b7 (Merge branch 'za/t2000-modernise', 2026-04-06)?\n\nThe topioc appeared first in the issue 2026/03 #12 of the \"What's\ncooking\" report (Mar 30th), marked for 'next'.  Then the issue\n2026/04 #01 of the report (Apr 1st) listed the topic in 'next'\nslated for 'master'.  The issue 2026/03 #02 (Apr 6th) reports it is\nnow in 'master'.\n\nThe description of this v5 patch looks suspiciously similar, as its\npatch text, so I suspect it won't apply to my tree.\n\n\n"},{"id":"541073","messageId":"xmqqzf3e69at.fsf@gitster.g","threadId":"65355","inReplyTo":"xmqqmrze7sj9.fsf@gitster.g","subject":"Re: [PATCH v5] t2000: modernize overall structure and path checks","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-04-07T16:10:18Z","receivedAt":"2026-04-07T16:10:22Z","isPatch":true,"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> The description of this v5 patch looks suspiciously similar, as its\n> patch text, so I suspect it won't apply to my tree.\n\nSo, I applied this \"v5\" to a slightly older 'master', immediately\nbefore the za/t2000-modernise topic was merged, and compared the\nresult with what we already have in 'master'.\n\n    $ git log -1 --oneline 0713d3b7f6\n    0713d3b7f6 Merge branch 'za/t2000-modernise'\n    $ git checkout 0713d3b7f6~1\n    $ git am patch-v5.mbox\n    $ git diff 0713d3b7f6 HEAD\n\nThere are some things that are better, and some that do not look\nimprovements.\n\n> diff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh\n> index af199d8191..44728329f3 100755\n> --- a/t/t2000-conflict-when-checking-files-out.sh\n> +++ b/t/t2000-conflict-when-checking-files-out.sh\n> @@ -35,19 +35,18 @@ show_files() {\n>  \tsed -e 's/^\\([0-9]*\\)\t[^ ]*\t[0-9a-f]*\t/tr: \\1 /'\n>  }\n>  \n> -test_expect_success 'prepare files path0 and path1/file1' '\n> -\tdate >path0 &&\n> -\tmkdir path1 &&\n> -\tdate >path1/file1 &&\n> -\tgit update-index --add path0 path1/file1\n> -'\n> +date >path0\n> +mkdir path1\n> +date >path1/file1\n>  \n> -test_expect_success 'prepare working tree files with D/F conflicts' '\n> -\trm -fr path0 path1 &&\n> -\tmkdir path0 &&\n> -\tdate >path0/file0 &&\n> -\tdate >path1\n> -'\n> +test_expect_success \\\n> +    'git update-index --add various paths.' \\\n> +    'git update-index --add path0 path1/file1'\n> +\n> +rm -fr path0 path1\n> +mkdir path0\n> +date >path0/file0\n> +date >path1\n\nAll of the above look regression to me, for the purpose of\n\"modernization\" effort.  We want the steps to prepare for tests\n(e.g., creation of test files and directories and preparation of\ntheir contents), the steps of actual tests (e.g., running git\ncommands and ensuring that they succeed or fail as expected), and\nthe steps to verify the results, all contained inside a single\ntest_expect_success for each step of the test. \n\nOn the other hand, the below looks like moving things in a better\ndirection.  The original has a logically single test split into\nmultiple pieces and code to debug tests sprinkled all over,\nlike ...\n\n> @@ -83,59 +82,22 @@ test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n>  # path path3 is occupied by a non-directory.  With \"-f\" it should remove\n>  # the symlink path3 and create directory path3 and file path3/file1.\n>  \n> -test_expect_success 'prepare path2/file0 and index' '\n> +test_expect_success 'checkout-index -f resolves symlink conflict on leading path' '\n>  \tmkdir path2 &&\n>  \tdate >path2/file0 &&\n> -\tgit update-index --add path2/file0\n> -'\n> -\n> -test_expect_success 'write tree with path2/file0' '\n> -\ttree1=$(git write-tree)\n> -'\n> -\n> -test_debug 'show_files $tree1'\n\n... this one.  And consolidating them into a single logical piece\nmay make sense.\n\nBut it seems not quite complete and needs a bit more cleaning.  For\nexample, ...\n\n> -test_expect_success 'prepare path3/file1 and index' '\n> +\tgit update-index --add path2/file0 &&\n> +\ttree1=$(git write-tree) &&\n>  \tmkdir path3 &&\n>  \tdate >path3/file1 &&\n> -\tgit update-index --add path3/file1\n> -'\n> -\n> -test_expect_success 'write tree with path3/file1' '\n> -\ttree2=$(git write-tree)\n> -'\n> -\n> -test_debug 'show_files $tree2'\n> -\n> -test_expect_success 'read previously written tree and checkout.' '\n> +\tgit update-index --add path3/file1 &&\n> +\ttree2=$(git write-tree) &&\n>  \trm -fr path3 &&\n>  \tgit read-tree -m $tree1 &&\n> -\tgit checkout-index -f -a\n> -'\n> -\n> -test_debug 'show_files $tree1'\n> -\n> -test_expect_success 'add a symlink' '\n> -\ttest_ln_s_add path2 path3\n> -'\n> -\n> -test_expect_success 'write tree with symlink path3' '\n> -\ttree3=$(git write-tree)\n> -'\n\n... we used to write out $tree3 here only because ...\n\n> -\n> -test_debug 'show_files $tree3'\n\n... we use it to debug that tree here.  In the updated version, we\nstill write out ...\n\n> -# Morten says \"Got that?\" here.\n> -# Test begins.\n> -\n> -test_expect_success 'read previously written tree and checkout.' '\n> +\tgit checkout-index -f -a &&\n> +\ttest_ln_s_add path2 path3 &&\n> +\ttree3=$(git write-tree) &&\n\n... the same tree3 here, but because we lost the test debug, we no\nlonger use the resulting tree object name.\n\n>  \tgit read-tree $tree2 &&\n> -\tgit checkout-index -f -a\n> -'\n> -\n> -test_debug 'show_files $tree2'\n> -\n> -test_expect_success 'checking out conflicting path with -f' '\n> +\tgit checkout-index -f -a &&\n>  \ttest_path_is_dir_not_symlink path2 &&\n>  \ttest_path_is_dir_not_symlink path3 &&\n>  \ttest_path_is_file_not_symlink path2/file0 &&\n\nI didn't go through the updated version with fine toothed comb, so\nthere may be other \"why is this thing left?\" and/or \"this update\nchanges what is being tested, no?\" gotchas that I missed.\n\nIn any case, can you update the patch so that it applies cleanly to\na more recent \"master\" to resurrect the good bits out of what you\nhave?\n\nThanks.\n"},{"id":"542468","messageId":"20260429103607.406339-1-zakariyahali100@gmail.com","threadId":"65355","inReplyTo":"20260407034446.409175-1-zakariyahali100@gmail.com","subject":"[PATCH v6] t2000: consolidate second scenario into a single test block","fromName":"Zakariyah Ali","fromEmail":"zakariyahali100@gmail.com","sentAt":"2026-04-29T10:36:06Z","receivedAt":"2026-04-29T10:37:07Z","isPatch":true,"body":"The second test scenario in t2000 consists of several fragmented\ntest_expect_success blocks that handle data setup, tree writes,\nexecution of git-checkout-index, and final state validation.\n\nConsolidate these nine separate blocks into a single self-contained\ntest block. This follows the modern Git testing standard where setup,\nexecution, and validation of a single logical scenario are kept\ntogether.\n\nAs a result of this consolidation, the show_files() helper and its\nassociated test_debug calls are no longer used and have been removed.\nThis also removes a dependency on the non-portable 'find -ls' command.\n\nHelped-by: Karthik Nayak <karthik.188@gmail.com>\nHelped-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n---\nI'm sorry for replying very late; it was because of some commitments I had to attend to which I've been able to settle.\n\nChanges since v5:\n- Consolidate segmented test blocks in the second scenario into a single unit.\n- Remove unused show_files debug function and tree3 variable.\n- Ensure file setup is inside test_expect_success blocks.\n\n t/t2000-conflict-when-checking-files-out.sh | 65 +++------------------\n 1 file changed, 8 insertions(+), 57 deletions(-)\n\ndiff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh\nindex af199d8191..7b61370549 100755\n--- a/t/t2000-conflict-when-checking-files-out.sh\n+++ b/t/t2000-conflict-when-checking-files-out.sh\n@@ -23,17 +23,6 @@ test_description='git conflicts when checking files out test.'\n \n . ./test-lib.sh\n \n-show_files() {\n-\t# show filesystem files, just [-dl] for type and name\n-\tfind path? -ls |\n-\tsed -e 's/^[0-9]* * [0-9]* * \\([-bcdl]\\)[^ ]* *[0-9]* *[^ ]* *[^ ]* *[0-9]* [A-Z][a-z][a-z] [0-9][0-9] [^ ]* /fs: \\1 /'\n-\t# what's in the cache, just mode and name\n-\tgit ls-files --stage |\n-\tsed -e 's/^\\([0-9]*\\) [0-9a-f]* [0-3] /ca: \\1 /'\n-\t# what's in the tree, just mode and name.\n-\tgit ls-tree -r \"$1\" |\n-\tsed -e 's/^\\([0-9]*\\)\t[^ ]*\t[0-9a-f]*\t/tr: \\1 /'\n-}\n \n test_expect_success 'prepare files path0 and path1/file1' '\n \tdate >path0 &&\n@@ -83,59 +72,21 @@ test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '\n # path path3 is occupied by a non-directory.  With \"-f\" it should remove\n # the symlink path3 and create directory path3 and file path3/file1.\n \n-test_expect_success 'prepare path2/file0 and index' '\n+test_expect_success 'checkout-index -f resolves symlink conflict on leading path' '\n \tmkdir path2 &&\n \tdate >path2/file0 &&\n-\tgit update-index --add path2/file0\n-'\n-\n-test_expect_success 'write tree with path2/file0' '\n-\ttree1=$(git write-tree)\n-'\n-\n-test_debug 'show_files $tree1'\n-\n-test_expect_success 'prepare path3/file1 and index' '\n+\tgit update-index --add path2/file0 &&\n+\ttree1=$(git write-tree) &&\n \tmkdir path3 &&\n \tdate >path3/file1 &&\n-\tgit update-index --add path3/file1\n-'\n-\n-test_expect_success 'write tree with path3/file1' '\n-\ttree2=$(git write-tree)\n-'\n-\n-test_debug 'show_files $tree2'\n-\n-test_expect_success 'read previously written tree and checkout.' '\n+\tgit update-index --add path3/file1 &&\n+\ttree2=$(git write-tree) &&\n \trm -fr path3 &&\n \tgit read-tree -m $tree1 &&\n-\tgit checkout-index -f -a\n-'\n-\n-test_debug 'show_files $tree1'\n-\n-test_expect_success 'add a symlink' '\n-\ttest_ln_s_add path2 path3\n-'\n-\n-test_expect_success 'write tree with symlink path3' '\n-\ttree3=$(git write-tree)\n-'\n-\n-test_debug 'show_files $tree3'\n-\n-# Morten says \"Got that?\" here.\n-# Test begins.\n-\n-test_expect_success 'read previously written tree and checkout.' '\n+\tgit checkout-index -f -a &&\n+\ttest_ln_s_add path2 path3 &&\n \tgit read-tree $tree2 &&\n-\tgit checkout-index -f -a\n-'\n-\n-test_debug 'show_files $tree2'\n-\n-test_expect_success 'checking out conflicting path with -f' '\n+\tgit checkout-index -f -a &&\n \ttest_path_is_dir_not_symlink path2 &&\n \ttest_path_is_dir_not_symlink path3 &&\n \ttest_path_is_file_not_symlink path2/file0 &&\n-- \n2.43.0\n\n"},{"id":"542742","messageId":"20260505064255.195476-1-zakariyahali100@gmail.com","threadId":"65355","inReplyTo":"20260429103607.406339-1-zakariyahali100@gmail.com","subject":"Re: [PATCH v6] t2000: consolidate second scenario into a single test block","fromName":"Zakariyah Ali","fromEmail":"zakariyahali100@gmail.com","sentAt":"2026-05-05T06:42:55Z","receivedAt":"2026-05-05T06:43:16Z","isPatch":true,"body":"Hi everyone,\n\nJust a gentle reminder on this v6 patch:\nhttps://lore.kernel.org/git/20260429103607.406339-1-zakariyahali100@gmail.com/\n\nI would be looking forward to your review.\n\nThanks,\nZakariyah Ali\n"},{"id":"543141","messageId":"xmqqfr3xnofn.fsf@gitster.g","threadId":"65355","inReplyTo":"20260429103607.406339-1-zakariyahali100@gmail.com","subject":"Re: [PATCH v6] t2000: consolidate second scenario into a single test block","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-05-12T06:15:40Z","receivedAt":"2026-05-12T06:15:46Z","isPatch":true,"body":"Zakariyah Ali <zakariyahali100@gmail.com> writes:\n\n> The second test scenario in t2000 consists of several fragmented\n> test_expect_success blocks that handle data setup, tree writes,\n> execution of git-checkout-index, and final state validation.\n>\n> Consolidate these nine separate blocks into a single self-contained\n> test block. This follows the modern Git testing standard where setup,\n> execution, and validation of a single logical scenario are kept\n> together.\n>\n> As a result of this consolidation, the show_files() helper and its\n> associated test_debug calls are no longer used and have been removed.\n> This also removes a dependency on the non-portable 'find -ls' command.\n\nThe patch, at first glance, looked quite messy but it turns out that\nit is mostly just a lot of removals of (1) early test closure\nfollowed by the start of the next test or (2) test_debug calls in\nbetween.  The only thing that was slightly outside that pattern was\nthe computation of tree3, whose result was not even used for\ntest_debug in the original.\n\nWill mark the topic for 'next'.  Thanks.\n"},{"id":"543215","messageId":"20260512200140.1016654-1-zakariyahali100@gmail.com","threadId":"65355","inReplyTo":"20260429103607.406339-1-zakariyahali100@gmail.com","subject":"Re: [PATCH v6] t2000: consolidate second scenario into a single test","fromName":"Zakariyah Ali","fromEmail":"zakariyahali100@gmail.com","sentAt":"2026-05-12T20:01:40Z","receivedAt":"2026-05-12T20:02:03Z","isPatch":true,"body":"Dear Junio,\n\nThank you very much for your patient, guidance and feedback throughout the development of this patch series. It has been an invaluable learning experience for me.\n\nWhile my initial goal with these contributions was to participate in GSoC internship, but I was unable to do so this time, however I have found the process of contributing to the Git ecosystem very rewarding. I am excited to stay involved and look forward to making more contributions in the future.\n\nAlso, I am a software engineer with over four years of experience in the field. I am currently seeking new opportunities, specifically entry-level or internship roles where I can continue to grow. If you happen to know of any openings or could offer any advice or assistance, I would be extremely grateful.\n\nThank you again for your time and for everything you do for the Git project.\n\nBest regards,\nZakariyah Ali\n"}]}