Skip to content

Commit c44afd6

Browse files
inosmeetgitster
authored andcommitted
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 <[email protected]> Mentored-by: shejialuo <[email protected]> Signed-off-by: Meet Soni <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ac0bad0 commit c44afd6

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

t/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ integration_tests = [
211211
't1451-fsck-buffer.sh',
212212
't1460-refs-migrate.sh',
213213
't1461-refs-list.sh',
214+
't1463-refs-optimize.sh',
214215
't1500-rev-parse.sh',
215216
't1501-work-tree.sh',
216217
't1502-rev-parse-parseopt.sh',
@@ -1219,4 +1220,4 @@ if perl.found() and time.found()
12191220
timeout: 0,
12201221
)
12211222
endforeach
1222-
endif
1223+
endif

t/t1463-refs-optimize.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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

0 commit comments

Comments
 (0)