summaryrefslogtreecommitdiff
path: root/t/t1900-repo.sh
diff options
context:
space:
mode:
authorLucas Seiki Oshiro <lucasseikioshiro@gmail.com>2025-08-16 19:46:01 -0300
committerJunio C Hamano <gitster@pobox.com>2025-08-17 09:13:40 -0700
commitacf2669b542d0a8daa505923e52d314bbae4a237 (patch)
tree55ed8c2e208dfb6a8322cf450b2c76e2d3b0b474 /t/t1900-repo.sh
parent9adb8a7fd132f6033db1f04f17f0687bf2ac84e2 (diff)
repo: add the field layout.bare
This commit is part of the series that introduces the new subcommand git-repo-info. The flag --is-bare-repository from git-rev-parse is used for retrieving whether the current repository is bare. This way, it is used for querying repository metadata, fitting in the purpose of git-repo-info. Then, add a new field layout.bare to the git-repo-info subcommand containing that information. Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk> Helped-by: Junio C Hamano <gitster@pobox.com> Helped-by: Justin Tobler <jltobler@gmail.com> Helped-by: Eric Sunshine <sunshine@sunshineco.com> Mentored-by: Karthik Nayak <karthik.188@gmail.com> Mentored-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1900-repo.sh')
-rwxr-xr-xt/t1900-repo.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t1900-repo.sh b/t/t1900-repo.sh
index be8a4b2499..b0438d276e 100755
--- a/t/t1900-repo.sh
+++ b/t/t1900-repo.sh
@@ -38,6 +38,23 @@ test_repo_info 'ref format files is retrieved correctly' \
test_repo_info 'ref format reftable is retrieved correctly' \
'git init --ref-format=reftable' 'format-reftable' 'references.format' 'reftable'
+test_repo_info 'bare repository = false is retrieved correctly' \
+ 'git init' 'nonbare' 'layout.bare' 'false'
+
+test_repo_info 'bare repository = true is retrieved correctly' \
+ 'git init --bare' 'bare' 'layout.bare' 'true'
+
+test_expect_success 'values returned in order requested' '
+ cat >expect <<-\EOF &&
+ layout.bare=false
+ references.format=files
+ layout.bare=false
+ EOF
+ git init --ref-format=files ordered &&
+ git -C ordered repo info layout.bare references.format layout.bare >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'git-repo-info fails if an invalid key is requested' '
echo "error: key ${SQ}foo${SQ} not found" >expect &&
test_must_fail git repo info foo 2>actual &&