{"thread":{"id":"65680","subject":"[PATCH 0/2] [GSoC Patch] t2000: modernize path checks to use helper functions","startedAt":"2026-05-23T11:07:44Z","lastAt":"2026-05-24T09:55:36Z","messageCount":4,"participants":["Zakariyah Ali via GitGitGadget","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"543968","messageId":"pull.2256.git.git.1779534462.gitgitgadget@gmail.com","threadId":"65680","inReplyTo":null,"subject":"[PATCH 0/2] [GSoC Patch] t2000: modernize path checks to use helper functions","fromName":"Zakariyah Ali via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-05-23T11:07:40Z","receivedAt":"2026-05-23T11:07:44Z","isPatch":true,"body":"This is my GSoC microproject submission modernizing test path checks in\nt/t2000-conflict-when-checking-files-out.sh.\n\nReplace old-style path checks using test -f, test -d, and test ! -h with\ndedicated test helper functions for improved test clarity and consistency.\n\nThis modernization improves test script readability by using Git's dedicated\ntest helpers:\n\ntest -f → test_path_is_file test -d → test_path_is_dir test ! -h && test -f\n→ test_path_is_file_not_symlink test ! -h && test -d →\ntest_path_is_dir_not_symlink Found instances using: git grep 'test -[efd]'\nt/ | grep 'test -[efd].*&&'\n\nConverted 5 instances in t/t2000-conflict-when-checking-files-out.sh\n\nThis improves test clarity and consistency across the test suite.\n\nI'm excited to contribute to Git and look forward to your feedback!\n\nZakariyah Ali (2):\n  t2000: consolidate second scenario into a single test block\n  t2000: cleanup unused debug code and variables\n\n t/t2000-conflict-when-checking-files-out.sh | 65 +++------------------\n 1 file changed, 8 insertions(+), 57 deletions(-)\n\n\nbase-commit: 60f07c4f5c5f81c8a994d9e06b31a4a3a1679864\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2256%2Falibaba0010%2Fmodernize-test-path-checking-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2256/alibaba0010/modernize-test-path-checking-v1\nPull-Request: https://github.com/git/git/pull/2256\n-- \ngitgitgadget\n"},{"id":"543969","messageId":"4da209249227f6a824cc34c8697d1ed79dfa18e0.1779534462.git.gitgitgadget@gmail.com","threadId":"65680","inReplyTo":"pull.2256.git.git.1779534462.gitgitgadget@gmail.com","subject":"[PATCH 1/2] t2000: consolidate second scenario into a single test block","fromName":"Zakariyah Ali via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-05-23T11:07:41Z","receivedAt":"2026-05-23T11:07:45Z","isPatch":true,"body":"From: Zakariyah Ali <zakariyahali100@gmail.com>\n\nNow that the test script has been modernised, consolidate the eight\nseparate test_expect_success blocks that together form the second\ntest scenario (setup, tree writes, checkout, symlink creation, and\nfinal state check) into one self-contained block.\n\nThis makes it easier to read: data set-up, the operations being\ntested, and the expected outcome are now all in one place.\n\nHelped-by: Karthik Nayak <karthik.188@gmail.com>\nSigned-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n---\n t/t2000-conflict-when-checking-files-out.sh | 55 ++++-----------------\n 1 file changed, 9 insertions(+), 46 deletions(-)\n\ndiff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh\nindex af199d8191..43ec901f9e 100755\n--- a/t/t2000-conflict-when-checking-files-out.sh\n+++ b/t/t2000-conflict-when-checking-files-out.sh\n@@ -83,59 +83,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-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+\ttree3=$(git write-tree) &&\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-- \ngitgitgadget\n\n"},{"id":"543970","messageId":"87c80205cc3c7be131cafe37b786311a35b4e044.1779534462.git.gitgitgadget@gmail.com","threadId":"65680","inReplyTo":"pull.2256.git.git.1779534462.gitgitgadget@gmail.com","subject":"[PATCH 2/2] t2000: cleanup unused debug code and variables","fromName":"Zakariyah Ali via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-05-23T11:07:42Z","receivedAt":"2026-05-23T11:07:46Z","isPatch":true,"body":"From: Zakariyah Ali <zakariyahali100@gmail.com>\n\nRemove the show_files function which is no longer used after removing\ntest_debug calls, and remove an unused tree3 variable assignment in\nthe second test scenario.\n\nThese cleanups address feedback from Junio C Hamano regarding the\nmodernization of this test script.\n\nSigned-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n---\n t/t2000-conflict-when-checking-files-out.sh | 12 ------------\n 1 file changed, 12 deletions(-)\n\ndiff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh\nindex 43ec901f9e..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@@ -96,7 +85,6 @@ test_expect_success 'checkout-index -f resolves symlink conflict on leading path\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-- \ngitgitgadget\n"},{"id":"543995","messageId":"xmqqldd9i12i.fsf@gitster.g","threadId":"65680","inReplyTo":"pull.2256.git.git.1779534462.gitgitgadget@gmail.com","subject":"Re: [PATCH 0/2] [GSoC Patch] t2000: modernize path checks to use helper functions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-05-24T09:55:33Z","receivedAt":"2026-05-24T09:55:36Z","isPatch":true,"body":"\"Zakariyah Ali via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> This is my GSoC microproject submission modernizing test path checks in\n> t/t2000-conflict-when-checking-files-out.sh.\n\nI do not quite get where you intend to fit these two patches.\n\n> base-commit: 60f07c4f5c5f81c8a994d9e06b31a4a3a1679864\n\nThis is fairly old, v2.54.0-rc2~9.\n\nBut the thing is, your earlier clean-up to this t2000 script\n4a9e0972 (t2000: consolidate second scenario into a single test\nblock, 2026-04-29) was queued on za/t2000-modernise-more was merged\nto 'master' at b5d94909 (Merge branch 'za/t2000-modernise-more',\n2026-05-21).  But what is most curious about these two patches is\nthat the [PATCH 1/2] starts like so:\n\n    From: Zakariyah Ali <zakariyahali100@gmail.com>\n\n    Now that the test script has been modernised, consolidate the eight\n    separate test_expect_success blocks ...\n\nI take that to be a reference to your previous effort in za/t2000-modernise-more\ntopic.  But these two patches are changing the code as if that did\nnot even exist.\n\nIf the za/t2000-modernise-more topic were still not merged to\n'next', sending in replacement patches works just fine. but a new\npatch that ignores anything that have already been merged to 'next'\nor 'master' is counter-productive.\n\n\n\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2256%2Falibaba0010%2Fmodernize-test-path-checking-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2256/alibaba0010/modernize-test-path-checking-v1\n> Pull-Request: https://github.com/git/git/pull/2256\n"}]}