]> git.ipfire.org Git - thirdparty/git.git/commit
t1422: refactor tests to be shareable
authorMeet Soni <meetsoni3017@gmail.com>
Tue, 26 Aug 2025 06:41:09 +0000 (12:11 +0530)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Sep 2025 16:58:36 +0000 (09:58 -0700)
commit01d429c7bfe6bc494ca43476dfc08cec0ad90a4a
tree60aa7ba2cc7f4eca35dc81d3168af218e8ad1c0c
parent0749b93ab369cda5e316da1c2a87d325ce02fe1d
t1422: refactor tests to be shareable

In preparation for adding tests for the `git refs exists` command,
refactor the existing t1422 test suite to make its logic shareable.

Move the core test logic from `t1422-show-ref-exists.sh` to
`show-ref-exists-tests.sh` file. Inside this script, replace hardcoded
calls to "git show-ref --exists" with the `$git_show_ref_exists`
variable.

The original `t1422-show-ref-exists.sh` script now becomes a simple
"driver". It is responsible for setting the default value of the
variable and then sourcing the test library.

This structure follows an established pattern for sharing tests and
prepares the test suite for the `refs exists` tests to be added in a
subsequent commit.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Meet Soni <meetsoni3017@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/show-ref-exists-tests.sh [new file with mode: 0644]
t/t1422-show-ref-exists.sh [changed mode: 0644->0755]