public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] t1900: add tests for git repo structure subcommand
@ 2026-03-10  3:09 Mansi Singh via GitGitGadget
  2026-03-10  3:35 ` Junio C Hamano
  2026-03-10 13:34 ` K Jayatheerth
  0 siblings, 2 replies; 3+ messages in thread
From: Mansi Singh via GitGitGadget @ 2026-03-10  3:09 UTC (permalink / raw)
  To: git; +Cc: Mansi Singh, Mansi Singh

From: Mansi Singh <mansimaanu8627@gmail.com>

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=keyvalue outputs expected keys
- git repo structure --format=nul succeeds
- git repo structure rejects an unknown format

Signed-off-by: Mansi Singh <mansimaanu8627@gmail.com>
---
    t1900: add tests for git repo structure subcommand
    
    Add tests for the git repo structure subcommand in t1900-repo-info.sh.
    The tests verify that git repo structure outputs the expected fields
    (commits, trees, blobs, tags) in both default and key-value formats.
    
    Signed-off-by: Mansi Singh mansimaanu8627@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2066%2FMansiSingh17%2Frepo-add-structure-tests-v3-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2066/MansiSingh17/repo-add-structure-tests-v3-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2066

 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 a9eb07abe8..b63d404075 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

base-commit: d181b9354cf85b44455ce3ca9e6af0b9559e0ae2
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] t1900: add tests for git repo structure subcommand
  2026-03-10  3:09 [PATCH] t1900: add tests for git repo structure subcommand Mansi Singh via GitGitGadget
@ 2026-03-10  3:35 ` Junio C Hamano
  2026-03-10 13:34 ` K Jayatheerth
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2026-03-10  3:35 UTC (permalink / raw)
  To: Mansi Singh via GitGitGadget; +Cc: git, Mansi Singh

"Mansi Singh via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Mansi Singh <mansimaanu8627@gmail.com>
>
> 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=keyvalue outputs expected keys
> - git repo structure --format=nul succeeds
> - git repo structure rejects an unknown format

Ask those who have worked on the relevant command to review by
adding them on the Cc: line.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] t1900: add tests for git repo structure subcommand
  2026-03-10  3:09 [PATCH] t1900: add tests for git repo structure subcommand Mansi Singh via GitGitGadget
  2026-03-10  3:35 ` Junio C Hamano
@ 2026-03-10 13:34 ` K Jayatheerth
  1 sibling, 0 replies; 3+ messages in thread
From: K Jayatheerth @ 2026-03-10 13:34 UTC (permalink / raw)
  To: gitgitgadget; +Cc: git, mansimaanu8627

> From: Mansi Singh <mansimaanu8627@gmail.com>
> 
> 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=keyvalue outputs expected keys
> - git repo structure --format=nul succeeds
> - git repo structure rejects an unknown format
> 
> Signed-off-by: Mansi Singh <mansimaanu8627@gmail.com>
> ---
>     t1900: add tests for git repo structure subcommand
> 
>     Add tests for the git repo structure subcommand in t1900-repo-info.sh.
>     The tests verify that git repo structure outputs the expected fields
>     (commits, trees, blobs, tags) in both default and key-value formats.
> 
>     Signed-off-by: Mansi Singh mansimaanu8627@gmail.com
> 
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2066%2FMansiSingh17%2Frepo-add-structure-tests-v3-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2066/MansiSingh17/repo-add-structure-tests-v3-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/2066
> 
>  t/t1900-repo-info.sh | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 


Hi,

The very next file in t/
i.e t1901.. is about repo structure

You might wanna check that out
because I find most of these to be redundant

Regards
- Jayatheerth

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-10 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10  3:09 [PATCH] t1900: add tests for git repo structure subcommand Mansi Singh via GitGitGadget
2026-03-10  3:35 ` Junio C Hamano
2026-03-10 13:34 ` K Jayatheerth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox