Skip to content

Commit ef94b3e

Browse files
inosmeetgitster
authored andcommitted
t: add test for git refs exists subcommand
Add a test script, `t/t1462-refs-exists.sh`, for the `git refs exists` command. This script acts as a simple driver, leveraging the shared test library created in the preceding commit. It works by overriding the `$git_show_ref_exists` variable to "git refs exists" and then sourcing the shared library (`t/show-ref-exists-tests.sh`). This approach ensures that `git refs exists` is tested against the entire comprehensive test suite of `git show-ref --exists`, 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]> Acked-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 01d429c commit ef94b3e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

t/meson.build

Lines changed: 1 addition & 0 deletions
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+
't1462-refs-exists.sh',
214215
't1500-rev-parse.sh',
215216
't1501-work-tree.sh',
216217
't1502-rev-parse-parseopt.sh',

t/t1462-refs-exists.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
test_description='refs exists'
4+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5+
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6+
7+
. ./test-lib.sh
8+
9+
git_show_ref_exists='git refs exists'
10+
. "$TEST_DIRECTORY"/show-ref-exists-tests.sh

0 commit comments

Comments
 (0)