aboutsummaryrefslogtreecommitdiffstats
path: root/t/t1900-repo.sh
diff options
context:
space:
mode:
authorLucas Seiki Oshiro <lucasseikioshiro@gmail.com>2025-09-04 10:40:16 -0300
committerJunio C Hamano <gitster@pobox.com>2025-09-04 11:36:39 -0700
commita92f5ca0d5c1b27f70a519efba967d613fd48a7a (patch)
tree6c40ab17d68988c5be5c597f48aab7b183d71978 /t/t1900-repo.sh
parentc8f660a7cab5ab3b9c57677e66cb41bb57ee0114 (diff)
downloadgit-a92f5ca0d5c1b27f70a519efba967d613fd48a7a.tar.gz
repo: add the flag -z as an alias for --format=nul
Other Git commands that have nul-terminated output (e.g. git-config, git-status, git-ls-files) have a flag `-z` for using the null character as the record separator. Add the `-z` flag to git-repo-info as an alias for `--format=nul`, making it consistent with the behavior of the other commands. 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.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t1900-repo.sh b/t/t1900-repo.sh
index a69c715357..ddf788d5a2 100755
--- a/t/t1900-repo.sh
+++ b/t/t1900-repo.sh
@@ -92,4 +92,16 @@ test_expect_success 'git-repo-info aborts when requesting an invalid format' '
test_cmp expect actual
'
+test_expect_success '-z uses nul-terminated format' '
+ printf "layout.bare\nfalse\0layout.shallow\nfalse\0" >expected &&
+ git repo info -z layout.bare layout.shallow >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'git repo info uses the last requested format' '
+ echo "layout.bare=false" >expected &&
+ git repo info --format=nul -z --format=keyvalue layout.bare >actual &&
+ test_cmp expected actual
+'
+
test_done