[PATCH 0/1] repo: add filtering options to "repo structure"
From: Mark C. Chu-Carroll <hidden>
Date: 2026-09-24 16:45:15
repo: add filtering options to "repo structure"
"git repo structure" provides a collection of useful information
about the information stored in a repo. In particular, it's
valuable for diagnosing performance issues caused by large objects
stored in a repo.
The current implementation of "git repo stucture" provides summary
information about everything in the repository - all of the
branches, remotes, tags, stashes, and notes. But sometimes
to properly diagnose a problem, it's useful to be able to exclude
refs that are known to not be relevant to the issue at hand.
Add a set of flags that allow a user to selective exclude
reference types from the report generated by "git repo structure".
When a ref type is excluded by the filter, it no longer appears
in the report (ie, if "--no-tags" is passed, the report line
for "Branches" will no longer appear under "* References").
Following the pattern of flags that are only used to
disable functionality (eg, "--no-verify" in "builtins/push.c"),
only the "--no-<reftype>" syntax is listed in the updated
documentation.
Overview of the changes:
- Add an enum to represent the structure flags.
- Add structure flags to the options for the "repo structure" commands.
- For each reference flag, add a conditional in "count_references"
which decides whether or not to add a ref to the pending list.
If an references is not added to the pending list, the things it
transitively references will not be added to the stats.
- Add a set of test cases to verify that reference counts
in the repo structure report correctly omit the specified
resource types.
- Update the documentation for git-repo to include the new options.
Mark C. Chu-Carroll (1):
repo: add filtering options to "repo structure"
Documentation/git-repo.adoc | 35 ++++-
builtin/repo.c | 158 +++++++++++++++------
t/t1901-repo-structure.sh | 276 ++++++++++++++++++++++++++++++++++++
3 files changed, 427 insertions(+), 42 deletions(-)
--
2.53.0