aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-30 18:31:39 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-30 18:31:39 -0800
commit0fec747d599c9f8b8304c97f501bf3022b99f5c8 (patch)
tree96d3291135f897f61018b4cf5613926f05a83dc1 /t
parentb31ab939fe8e3cbe8be48dddd1c6ac0265991f45 (diff)
parent155caac7d1fa981b21192c598cf9bbffdb5aea12 (diff)
downloadgit-0fec747d599c9f8b8304c97f501bf3022b99f5c8.tar.xz
Merge branch 'lo/repo-info-all'
"git repo info" learned "--all" option. * lo/repo-info-all: repo: add --all to git-repo-info repo: factor out field printing to dedicated function
Diffstat (limited to 't')
-rwxr-xr-xt/t1900-repo.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/t1900-repo.sh b/t/t1900-repo.sh
index 2beba67889..51d55f11a5 100755
--- a/t/t1900-repo.sh
+++ b/t/t1900-repo.sh
@@ -4,6 +4,15 @@ test_description='test git repo-info'
. ./test-lib.sh
+# git-repo-info keys. It must contain the same keys listed in the const
+# repo_info_fields, in lexicographical order.
+REPO_INFO_KEYS='
+ layout.bare
+ layout.shallow
+ object.format
+ references.format
+'
+
# Test whether a key-value pair is correctly returned
#
# Usage: test_repo_info <label> <init command> <repo_name> <key> <expected value>
@@ -110,4 +119,16 @@ test_expect_success 'git repo info uses the last requested format' '
test_cmp expected actual
'
+test_expect_success 'git repo info --all returns all key-value pairs' '
+ git repo info $REPO_INFO_KEYS >expect &&
+ git repo info --all >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'git repo info --all <key> aborts' '
+ echo "fatal: --all and <key> cannot be used together" >expect &&
+ test_must_fail git repo info --all object.format 2>actual &&
+ test_cmp expect actual
+'
+
test_done