{"thread":{"id":"65356","subject":"[GSoC][PATCH] t2000: modernize path checks to use helper functions","startedAt":"2026-03-26T11:22:29Z","lastAt":"2026-03-26T12:20:16Z","messageCount":2,"participants":["Zakariyah Ali","Pablo"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"540054","messageId":"20260326112149.53050-1-zakariyahali100@gmail.com","threadId":"65356","inReplyTo":null,"subject":"[GSoC][PATCH] t2000: modernize path checks to use helper functions","fromName":"Zakariyah Ali","fromEmail":"zakariyahali100@gmail.com","sentAt":"2026-03-26T11:21:49Z","receivedAt":"2026-03-26T11:22:29Z","isPatch":true,"sender":{"key":"zakariyahali100@gmail.com","avatar":null},"body":"Replace bare 'test -f/-d' and 'test ! -h ... && test -f/-d'\nassertions with their dedicated test_path_is_* helpers.\n\nThese helpers are better than the previous 'test' commands\nbecause they produce clearer diagnostic output on failure.\nFor example, instead of a bare exit code, the helper outputs\n'File path0 doesn't exist', which makes test failures\nsignificantly easier to debug.\n\nThe replacements are:\n- 'test -f' -> 'test_path_is_file'\n- 'test -d' -> 'test_path_is_dir'\n- 'test ! -h && test -f' -> 'test_path_is_file_not_symlink'\n- 'test ! -h && test -d' -> 'test_path_is_dir_not_symlink'\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":"540055","messageId":"CAN5EUNTSO7KvtO02c-EHJTK95rmcZKRBtKsn8kjNid1qupWZ0w@mail.gmail.com","threadId":"65356","inReplyTo":"20260326112149.53050-1-zakariyahali100@gmail.com","subject":"Re: [GSoC][PATCH] t2000: modernize path checks to use helper functions","fromName":"Pablo","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-03-26T12:19:58Z","receivedAt":"2026-03-26T12:20:16Z","isPatch":true,"sender":{"key":"pabloosabaterr@gmail.com","avatar":null},"body":"Zakariyah Ali (<zakariyahali100@gmail.com>) escribió:\n\nThis should be sent as v2 in reply to your previous v1, not a new thread.\nread Documentation/SubmittingPatches and\nDocumentation/MyFirstContribution as I mentioned in your v1.\n\n>\n> Replace bare 'test -f/-d' and 'test ! -h ... && test -f/-d'\n> assertions with their dedicated test_path_is_* helpers.\n>\n> These helpers are better than the previous 'test' commands\n> because they produce clearer diagnostic output on failure.\n> For example, instead of a bare exit code, the helper outputs\n> 'File path0 doesn't exist', which makes test failures\n> significantly easier to debug.\n>\n> The replacements are:\n> - 'test -f' -> 'test_path_is_file'\n> - 'test -d' -> 'test_path_is_dir'\n> - 'test ! -h && test -f' -> 'test_path_is_file_not_symlink'\n> - 'test ! -h && test -d' -> 'test_path_is_dir_not_symlink'\n>\n\nThe commit message is better now, but it's very verbose. The list\nabout what helpers have you changed can be looked at by any reviewer\nwith git log -p and the example only describes one helper, you should\nbe able to make it more general with something like: reports loudly\nwhat expectation wasn't met, 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>\n> diff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh\n> index 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>         mkdir -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> --\n> 2.43.0\n>\n>\n\nCode looks OK.\n"}]}