{"thread":{"id":"65244","subject":"[PATCH v2] t/pack-refs-tests: use test_path_is_missing","startedAt":"2026-03-14T06:06:26Z","lastAt":"2026-03-14T16:39:24Z","messageCount":2,"participants":["Ritesh Singh Jadoun","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"538954","messageId":"20260314060550.1277-1-riteshjd75@gmail.com","threadId":"65244","inReplyTo":null,"subject":"[PATCH v2] t/pack-refs-tests: use test_path_is_missing","fromName":"Ritesh Singh Jadoun","fromEmail":"riteshjd75@gmail.com","sentAt":"2026-03-14T06:05:50Z","receivedAt":"2026-03-14T06:06:26Z","isPatch":true,"sender":{"key":"riteshjd75@gmail.com","avatar":"https://avatars.githubusercontent.com/u/181055371?v=4"},"body":"The pack-refs tests currently use raw 'test -f' checks with negation.\nUpdate them to use Git's standard helper function test_path_is_missing\nfor consistency and clearer failure reporting. This aligns with\nCodingGuidelines and makes test failures more obvious.\n\nSigned-off-by: Ritesh Singh Jadoun <riteshjd75@gmail.com>\n---\n t/pack-refs-tests.sh | 28 ++++++++++++++--------------\n 1 file changed, 14 insertions(+), 14 deletions(-)\n\ndiff --git a/t/pack-refs-tests.sh b/t/pack-refs-tests.sh\nindex 2fdaccb6c7..3cc4906f05 100644\n--- a/t/pack-refs-tests.sh\n+++ b/t/pack-refs-tests.sh\n@@ -61,13 +61,13 @@ test_expect_success 'see if a branch still exists after git ${pack_refs} --prune\n test_expect_success 'see if git ${pack_refs} --prune remove ref files' '\n \tgit branch f &&\n \tgit ${pack_refs} --all --prune &&\n-\t! test -f .git/refs/heads/f\n+\ttest_path_is_missing .git/refs/heads/f\n '\n \n test_expect_success 'see if git ${pack_refs} --prune removes empty dirs' '\n \tgit branch r/s/t &&\n \tgit ${pack_refs} --all --prune &&\n-\t! test -e .git/refs/heads/r\n+\t! test_path_exists .git/refs/heads/r\n '\n \n test_expect_success 'git branch g should work when git branch g/h has been deleted' '\n@@ -111,43 +111,43 @@ test_expect_success 'test excluded refs are not packed' '\n \tgit branch dont_pack2 &&\n \tgit branch pack_this &&\n \tgit ${pack_refs} --all --exclude \"refs/heads/dont_pack*\" &&\n-\ttest -f .git/refs/heads/dont_pack1 &&\n-\ttest -f .git/refs/heads/dont_pack2 &&\n-\t! test -f .git/refs/heads/pack_this'\n+\ttest_path_is_file .git/refs/heads/dont_pack1 &&\n+\ttest_path_is_file .git/refs/heads/dont_pack2 &&\n+\ttest_path_is_missing .git/refs/heads/pack_this'\n \n test_expect_success 'test --no-exclude refs clears excluded refs' '\n \tgit branch dont_pack3 &&\n \tgit branch dont_pack4 &&\n \tgit ${pack_refs} --all --exclude \"refs/heads/dont_pack*\" --no-exclude &&\n-\t! test -f .git/refs/heads/dont_pack3 &&\n-\t! test -f .git/refs/heads/dont_pack4'\n+\ttest_path_is_missing .git/refs/heads/dont_pack3 &&\n+\ttest_path_is_missing .git/refs/heads/dont_pack4'\n \n test_expect_success 'test only included refs are packed' '\n \tgit branch pack_this1 &&\n \tgit branch pack_this2 &&\n \tgit tag dont_pack5 &&\n \tgit ${pack_refs} --include \"refs/heads/pack_this*\" &&\n-\ttest -f .git/refs/tags/dont_pack5 &&\n-\t! test -f .git/refs/heads/pack_this1 &&\n-\t! test -f .git/refs/heads/pack_this2'\n+\ttest_path_is_file .git/refs/tags/dont_pack5 &&\n+\ttest_path_is_missing .git/refs/heads/pack_this1 &&\n+\ttest_path_is_missing .git/refs/heads/pack_this2'\n \n test_expect_success 'test --no-include refs clears included refs' '\n \tgit branch pack1 &&\n \tgit branch pack2 &&\n \tgit ${pack_refs} --include \"refs/heads/pack*\" --no-include &&\n-\ttest -f .git/refs/heads/pack1 &&\n-\ttest -f .git/refs/heads/pack2'\n+\ttest_path_is_file .git/refs/heads/pack1 &&\n+\ttest_path_is_file .git/refs/heads/pack2'\n \n test_expect_success 'test --exclude takes precedence over --include' '\n \tgit branch dont_pack5 &&\n \tgit ${pack_refs} --include \"refs/heads/pack*\" --exclude \"refs/heads/pack*\" &&\n-\ttest -f .git/refs/heads/dont_pack5'\n+\ttest_path_is_file .git/refs/heads/dont_pack5'\n \n test_expect_success 'see if up-to-date packed refs are preserved' '\n \tgit branch q &&\n \tgit ${pack_refs} --all --prune &&\n \tgit update-ref refs/heads/q refs/heads/q &&\n-\t! test -f .git/refs/heads/q\n+\ttest_path_is_missing .git/refs/heads/q\n '\n \n test_expect_success 'pack, prune and repack' '\n-- \n2.46.0.windows.1\n\n"},{"id":"538977","messageId":"xmqq5x6yxt52.fsf@gitster.g","threadId":"65244","inReplyTo":"20260314060550.1277-1-riteshjd75@gmail.com","subject":"Re: [PATCH v2] t/pack-refs-tests: use test_path_is_missing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-14T16:39:21Z","receivedAt":"2026-03-14T16:39:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ritesh Singh Jadoun <riteshjd75@gmail.com> writes:\n\n> The pack-refs tests currently use raw 'test -f' checks with negation.\n> Update them to use Git's standard helper function test_path_is_missing\n> for consistency and clearer failure reporting. This aligns with\n> CodingGuidelines and makes test failures more obvious.\n>\n> Signed-off-by: Ritesh Singh Jadoun <riteshjd75@gmail.com>\n> ---\n>  t/pack-refs-tests.sh | 28 ++++++++++++++--------------\n>  1 file changed, 14 insertions(+), 14 deletions(-)\n>\n> diff --git a/t/pack-refs-tests.sh b/t/pack-refs-tests.sh\n> index 2fdaccb6c7..3cc4906f05 100644\n> --- a/t/pack-refs-tests.sh\n> +++ b/t/pack-refs-tests.sh\n> @@ -61,13 +61,13 @@ test_expect_success 'see if a branch still exists after git ${pack_refs} --prune\n>  test_expect_success 'see if git ${pack_refs} --prune remove ref files' '\n>  \tgit branch f &&\n>  \tgit ${pack_refs} --all --prune &&\n> -\t! test -f .git/refs/heads/f\n> +\ttest_path_is_missing .git/refs/heads/f\n>  '\n\nGood.\n\n>  test_expect_success 'see if git ${pack_refs} --prune removes empty dirs' '\n>  \tgit branch r/s/t &&\n>  \tgit ${pack_refs} --all --prune &&\n> -\t! test -e .git/refs/heads/r\n> +\t! test_path_exists .git/refs/heads/r\n>  '\n\nQuestionable.  When do we want to loudly tell the human about an\nunsatisfied expectation?  We expect .git/refs/heads/r not to exist,\nso we want to use \"test_path_is_missing\", no?\n\nPlease do double check the remainder of the patch, although from a\ncursory look I think you got them all correctly.\n\nTHanks.\n\n\n>  test_expect_success 'git branch g should work when git branch g/h has been deleted' '\n> @@ -111,43 +111,43 @@ test_expect_success 'test excluded refs are not packed' '\n>  \tgit branch dont_pack2 &&\n>  \tgit branch pack_this &&\n>  \tgit ${pack_refs} --all --exclude \"refs/heads/dont_pack*\" &&\n> -\ttest -f .git/refs/heads/dont_pack1 &&\n> -\ttest -f .git/refs/heads/dont_pack2 &&\n> -\t! test -f .git/refs/heads/pack_this'\n> +\ttest_path_is_file .git/refs/heads/dont_pack1 &&\n> +\ttest_path_is_file .git/refs/heads/dont_pack2 &&\n> +\ttest_path_is_missing .git/refs/heads/pack_this'\n>  \n>  test_expect_success 'test --no-exclude refs clears excluded refs' '\n>  \tgit branch dont_pack3 &&\n>  \tgit branch dont_pack4 &&\n>  \tgit ${pack_refs} --all --exclude \"refs/heads/dont_pack*\" --no-exclude &&\n> -\t! test -f .git/refs/heads/dont_pack3 &&\n> -\t! test -f .git/refs/heads/dont_pack4'\n> +\ttest_path_is_missing .git/refs/heads/dont_pack3 &&\n> +\ttest_path_is_missing .git/refs/heads/dont_pack4'\n>  \n>  test_expect_success 'test only included refs are packed' '\n>  \tgit branch pack_this1 &&\n>  \tgit branch pack_this2 &&\n>  \tgit tag dont_pack5 &&\n>  \tgit ${pack_refs} --include \"refs/heads/pack_this*\" &&\n> -\ttest -f .git/refs/tags/dont_pack5 &&\n> -\t! test -f .git/refs/heads/pack_this1 &&\n> -\t! test -f .git/refs/heads/pack_this2'\n> +\ttest_path_is_file .git/refs/tags/dont_pack5 &&\n> +\ttest_path_is_missing .git/refs/heads/pack_this1 &&\n> +\ttest_path_is_missing .git/refs/heads/pack_this2'\n>  \n>  test_expect_success 'test --no-include refs clears included refs' '\n>  \tgit branch pack1 &&\n>  \tgit branch pack2 &&\n>  \tgit ${pack_refs} --include \"refs/heads/pack*\" --no-include &&\n> -\ttest -f .git/refs/heads/pack1 &&\n> -\ttest -f .git/refs/heads/pack2'\n> +\ttest_path_is_file .git/refs/heads/pack1 &&\n> +\ttest_path_is_file .git/refs/heads/pack2'\n>  \n>  test_expect_success 'test --exclude takes precedence over --include' '\n>  \tgit branch dont_pack5 &&\n>  \tgit ${pack_refs} --include \"refs/heads/pack*\" --exclude \"refs/heads/pack*\" &&\n> -\ttest -f .git/refs/heads/dont_pack5'\n> +\ttest_path_is_file .git/refs/heads/dont_pack5'\n>  \n>  test_expect_success 'see if up-to-date packed refs are preserved' '\n>  \tgit branch q &&\n>  \tgit ${pack_refs} --all --prune &&\n>  \tgit update-ref refs/heads/q refs/heads/q &&\n> -\t! test -f .git/refs/heads/q\n> +\ttest_path_is_missing .git/refs/heads/q\n>  '\n>  \n>  test_expect_success 'pack, prune and repack' '\n"}]}