]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/repo: introduce structure subcommand
authorJustin Tobler <jltobler@gmail.com>
Tue, 21 Oct 2025 18:25:58 +0000 (13:25 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Oct 2025 21:40:37 +0000 (14:40 -0700)
commitbbb2b9334856ae0a2b18e65e5924a42c31a83c6b
treea6980c8afe0ffe563549acf19a4b3de33e9747a7
parent6d1997f6cbc10ac03bc450630de4410762f77b6f
builtin/repo: introduce structure subcommand

The structure of a repository's history can have huge impacts on the
performance and health of the repository itself. Currently, Git lacks a
means to surface repository metrics regarding its structure/shape via a
single command. Acquiring this information requires users to be familiar
with the relevant data points and the various Git commands required to
surface them. To fill this gap, supplemental tools such as git-sizer(1)
have been developed.

To allow users to more readily identify repository structure related
information, introduce the "structure" subcommand in git-repo(1). The
goal of this subcommand is to eventually provide similar functionality
to git-sizer(1), but natively in Git.

The initial version of this command only iterates through all references
in the repository and tracks the count of branches, tags, remote refs,
and other reference types. The corresponding information is displayed in
a human-friendly table formatted in a very similar manner to
git-sizer(1). The width of each table column is adjusted automatically
to satisfy the requirements of the widest row contained.

Subsequent commits will surface additional relevant data points to
output and also provide other more machine-friendly output formats.

Based-on-patch-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-repo.adoc
builtin/repo.c
t/meson.build
t/t1901-repo-structure.sh [new file with mode: 0755]