Git fork

t: add test for git refs optimize subcommand

Add a test script, `t/t1463-refs-optimize.sh`, for the new `git refs
optimize` command.

This script acts as a simple driver, leveraging the shared test library
created in the preceding commit. It works by overriding the
`$pack_refs` variable to "refs optimize" and then sourcing the
shared library (`t/pack-refs-tests.sh`).

This approach ensures that `git refs optimize` is tested against the
entire comprehensive test suite of `git pack-refs`, verifying
that it acts as a compatible drop-in replacement.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Meet Soni <meetsoni3017@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Meet Soni and committed by
Junio C Hamano
c44afd67 ac0bad0a

+19 -1
+2 -1
t/meson.build
··· 211 211 't1451-fsck-buffer.sh', 212 212 't1460-refs-migrate.sh', 213 213 't1461-refs-list.sh', 214 + 't1463-refs-optimize.sh', 214 215 't1500-rev-parse.sh', 215 216 't1501-work-tree.sh', 216 217 't1502-rev-parse-parseopt.sh', ··· 1219 1220 timeout: 0, 1220 1221 ) 1221 1222 endforeach 1222 - endif 1223 + endif
+17
t/t1463-refs-optimize.sh
··· 1 + #!/bin/sh 2 + 3 + test_description='git refs optimize should not change the branch semantic 4 + 5 + This test runs git refs optimize and git show-ref and checks that the branch 6 + semantic is still the same. 7 + ' 8 + 9 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 10 + export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 11 + GIT_TEST_DEFAULT_REF_FORMAT=files 12 + export GIT_TEST_DEFAULT_REF_FORMAT 13 + 14 + . ./test-lib.sh 15 + 16 + pack_refs='refs optimize' 17 + . "$TEST_DIRECTORY"/pack-refs-tests.sh