From 0c6911b20d858a29eefa2190187876724eaf3f51 Mon Sep 17 00:00:00 2001 From: Mansi Singh Date: Thu, 5 Mar 2026 20:55:15 -0800 Subject: [PATCH] t1900: add tests for git repo structure subcommand The t1900 test file covers git repo info thoroughly but has no tests for the git repo structure subcommand. Add basic tests to verify that: - git repo structure succeeds and produces no stderr output - git repo structure --format=lines outputs expected keys - git repo structure --format=nul succeeds - git repo structure rejects an unknown format Signed-off-by: Mansi Singh --- t/t1900-repo-info.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/t/t1900-repo-info.sh b/t/t1900-repo-info.sh index a9eb07abe8aaea..b63d4040755e57 100755 --- a/t/t1900-repo-info.sh +++ b/t/t1900-repo-info.sh @@ -149,4 +149,26 @@ test_expect_success 'git repo info --keys uses lines as its default output forma test_cmp expect actual ' + +test_expect_success 'git repo structure succeeds' ' + git repo structure >actual 2>stderr && + test_must_be_empty stderr +' + +test_expect_success 'git repo structure --format=lines succeeds' ' + git repo structure --format=lines >actual && + grep "references.branches.count=" actual && + grep "objects.commits.count=" actual +' + +test_expect_success 'git repo structure --format=nul succeeds' ' + git repo structure --format=nul >actual +' + +test_expect_success 'git repo structure rejects unknown format' ' + echo "fatal: invalid format ${SQ}foo${SQ}" >expect && + test_must_fail git repo structure --format=foo 2>actual && + test_cmp expect actual +' + test_done