Skip to content

t/pack-refs-tests: fix helper usage#2248

Open
jayesh0104 wants to merge 1 commit intogit:masterfrom
jayesh0104:fix-pack-refs-test
Open

t/pack-refs-tests: fix helper usage#2248
jayesh0104 wants to merge 1 commit intogit:masterfrom
jayesh0104:fix-pack-refs-test

Conversation

@jayesh0104
Copy link

High-level (Intent & Context)

The test script t/pack-refs-tests.sh has two issues that prevent it from running correctly.

It uses:
! test -f .git/refs/heads/f

This is inconsistent with the Git test framework, where helper functions such as test_path_is_missing should be used instead of raw test checks.

Low-level (Implementation & Justification)

Without sourcing test-lib.sh, the test framework is not initialized, leading to errors such as:
test_expect_success: not found

Replaced raw file check with the appropriate helper:

- ! test -f .git/refs/heads/f
+ test_path_is_missing .git/refs/heads/f

Summary

Replace test -f with test_path_is_missing
cc: K Jayatheerth [email protected]

test_path_is_missing expects exactly one argument: the path to
check for absence. Passing '-f' is incorrect and results in
"bug in the test script: 1 param" during test execution.

The '-f' flag appears to have been carried over from the
equivalent 'test -f' usage, but test_path_is_missing does not
accept such flags.

Remove the extraneous '-f' to use the helper correctly and
restore proper test behavior.

Signed-off-by: Jayesh Daga <[email protected]>
@jayesh0104
Copy link
Author

/submit

@jayesh0104 jayesh0104 changed the title t/pack-refs-tests: drop '-f' from test_path_is_missing t/pack-refs-tests: fix helper usage Mar 22, 2026
@gitgitgadget-git
Copy link

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-2248/jayesh0104/fix-pack-refs-test-v1

To fetch this version to local tag pr-git-2248/jayesh0104/fix-pack-refs-test-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-2248/jayesh0104/fix-pack-refs-test-v1

@jayesh0104
Copy link
Author

Hi Tian Yuchen,

Thanks for the review!

You're right, the earlier version mistakenly removed the shebang
and test framework lines along with changing the file mode. That
was unintentional, and I corrected it in the updated patch.

I'll make sure to properly version future updates as v2.

Thanks again for pointing this out.

@dscho
Copy link
Member

dscho commented Mar 23, 2026

Hi Tian Yuchen,

Thanks for the review!

You're right, the earlier version mistakenly removed the shebang and test framework lines along with changing the file mode. That was unintentional, and I corrected it in the updated patch.

I'll make sure to properly version future updates as v2.

Thanks again for pointing this out.

@jayesh0104 Unfortunately, this won't reach the intended recipient. You will have to follow the instructions in https://gitgitgadget.github.io/reply-to-this to send your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants