Skip to content

Commit 060248c

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 <ps@pks.im> Mentored-by: shejialuo <shejialuo@gmail.com> Signed-off-by: Meet Soni <meetsoni3017@gmail.com>
1 parent 705962a commit 060248c

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

t/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ integration_tests = [
213213
't1460-refs-migrate.sh',
214214
't1461-refs-list.sh',
215215
't1462-refs-exists.sh',
216+
't1463-refs-optimize.sh',
216217
't1500-rev-parse.sh',
217218
't1501-work-tree.sh',
218219
't1502-rev-parse-parseopt.sh',

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)