Re: [PATCH v4 6/6] list-objects-filter: implement filter tree:0
- From
Jeff King <peff@peff.net>
- Date
- Aug 14, 2018, 20:01 UTC
- Message-ID
- <20180814200154.GF28452@sigill.intra.peff.net>
- In-Reply-To
- <05e69ef260ca2b28b2444b94850bddf44ca0388a.1534267611.git.matvore@google.com>
On Tue, Aug 14, 2018 at 10:28:13AM -0700, Matthew DeVore wrote:
Show 5 quoted lines
> The name "tree:0" allows later filtering based on depth, i.e. "tree:1" > would filter out all but the root tree and blobs. In order to avoid > confusion between 0 and capital O, the documentation was worded in a > somewhat round-about way that also hints at this future improvement to > the feature.
I'm OK with this as a name, since we're explicitly not supporting deeper depths. But I'd note that "depth" is actually a tricky characteristic, as it's not a property of the object itself, but rather who refers to it. So:
- it's expensive to compute, because you have to actually walk all of
the possible commits and trees that could refer to it. This
prohibits a lot of other optimizations like reachability bitmaps
(though with some complexity you could cache the depths, too). - you have to define it as something like "the minimum depth at which
this object is found", since there may be multiple depthsI think you can read that second definition between the lines of:
> +The form '--filter=tree:<depth>' omits all blobs and trees deeper than > +<depth> from the root tree. Currently, only <depth>=0 is supported.
But I wonder if we should be more precise. It doesn't matter now, but it may help set expectations if the feature does come later.
-Peff