Re: [PATCH 0/7] rev-parse: implement object type filter
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 11, 2021, 14:43 UTC
- Message-ID
- <YEosm+RjD/YRIcLo@ncase>
- In-Reply-To
- <YElGANcek5DPxYKo@coredump.intra.peff.net>
On Wed, Mar 10, 2021 at 05:19:44PM -0500, Jeff King wrote:
Show 30 quoted lines
> On Wed, Mar 10, 2021 at 04:58:16PM -0500, Taylor Blau wrote: > > > On Mon, Mar 01, 2021 at 01:20:26PM +0100, Patrick Steinhardt wrote: > > > - A new object type filter `--filter=object:type=<type>` for > > > git-rev-list(1), which is implemented both for normal graph walks and > > > for the packfile bitmap index. > > > > I understand what you're looking for here, but I worry that '--filter' > > might be too leaky of an abstraction. > > > > I was a little surprised to learn that you can clone a repository with > > --filter=object:type=tree (excluding commits), but it does work. I'm > > fine reusing a lot of the object filtering code if it makes this an > > easier task, but I think it may be worthwhile to hide this new kind of > > filter from upload-pack. > > I had a similar thought, but wouldn't the existing uploadpackfilter > config take care of this? > > I guess the catch-all "allow" option defaults to "true", so we'd support > any new filters that are added. Which seems like a poor choice in > general, but flipping it would mean that servers have to update their > config. > > I do wonder if it's that bad for clients to be able to specify something > like this, though. Even though there's not that much use for it with a > regular partial clone, it could conceivably used for some special cases. > I do think it would be more useful if you could OR together multiple > types. Asking for "commits|tags|trees" is really the same as the already > useful "blob:none". And "commits|tags" is the same as tree:depth=0.
I did waste a few thoughts on how this should be handled. I see two ways of doing it:
- We could just implement the new `object:type` filter such that it
directly supports OR'ing. That's the easy way to do it, but it's
inflexible. - We could extend combined filters to support OR-semantics in
addition to the current AND-semantics. In the end, that'd be a
much more flexible approach and potentially allow additional
usecases.I lean more towards the latter as it feels like the better design. But it's more involved, and I'm not sure I want to do it as part of this patch series.
Patrick