Re: [PATCH 1/1] repo: add filtering options to "repo structure"
- From
- Mark C. Chu-Carroll <markchucarroll@fastmail.com>
- Date
- Oct 5, 2026, 18:52 UTC
- Message-ID
- <DLX4QVXQJTQ4.24JR7ES0P3H@fastmail.com>
- In-Reply-To
- <ar04uStCZ4pnEJ38@pks.im>
On Wed Sep 30, 2026 at 12:28 PM EDT, Patrick Steinhardt wrote:
Show 41 quoted lines
> On Thu, Sep 24, 2026 at 12:45:03PM -0400, Mark C. Chu-Carroll wrote: >> "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. > > Yes, indeed. Sometimes you may for example want to figure out where > exactly the storage size of a particular repository is going. Or in the > case of GitLab for example, we may have bookkeeping references that are > not controllable by customers. So we may only want to get the structure > for all the customer-controllable branches there. > >> 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. > > Hmm, okay. I would have expected that the user can essentially pass > arbitrary revisions as understood by git-log(1) et al. And if they pass > any such revisions, we should not enumerate anything but what they have > passed, so the flags shouldn't only be used to exclude. > > So, for example: > > $ git repo structure --branches > $ git repo structure master > $ git repo structure --all --not --branches > > I would hope that git-repo(1) can achieve that rather easily because I > expect that it uses `struct rev_info`, but let's read on.
That makes sense. My initial understanding was that most of what "git repo structure" does is internalize the functionality of git-sizer into the core of git. The only filters offered by git-sizer are type-based. But I agree that a commit list based filter is a lot more useful, so I've updated the patch set to implement it.
-Mark
-- Mark Craig Chu-Carroll (@MarkChuCarroll at gitlab) *** Software Tools/Math Geek - Software Engineer at Gitlab *** Work Email: mcarroll@gitlab.com / markchucarroll@fastmail.com *** Personal Blog: http://goodmath.org/blog / Personal email: markcc@gmail.com