Subject: Re: RFC: git cat-file --follow-symlinks?

From: David Turner <[email-masked]>
Date: Thu, 30 Apr 2015 12:00:22 -0700

On Thu, 2015-04-30 at 14:49 -0400, Jeff King wrote:
> On Thu, Apr 30, 2015 at 11:44:50AM -0700, David Turner wrote:
> 
> > > git ls-tree HEAD -- BUILD ?
> > 
> > This does not actually seem to work (even with -r); it only recurses
> > into directories that are named BUILD, rather than being equivalent to
> > git ls-tree -r HEAD |grep /BUILD$.
> 
> Ah, I thought that was what you wanted (to find specific files, not a
> pattern). I think `ls-tree` doesn't understand our normal pathspecs, for
> historical reasons.
> 
> > Also, BUILD files are scattered throughout the tree, so the entire tree
> > would still need to be traversed.  At present, our monorepo is not quite
> > large enough for this to matter (a full ls-tree only takes me 0.6s), but
> > it is growing.
> 
> But aren't you asking git to do that internally? I.e., it can limit the
> traversal for a prefix-match, but it cannot do so for an arbitrary
> filename. It has to open every tree. So the extra expense is really just
> the I/O over the pipe. That's not optimal, but it is a constant factor
> slowdown from what git would do internally.

No, I'm not trying to find all BUILD files -- only ones that are in the
transitive dependency tree of the target I'm trying to sparsely check
out. So if the target foo/bar/baz depends on morx/fleem, and morx/fleem
depends on plugh/xyzzy, then I have to examine those three places only.
I don't have to examine anything in the gibbberish/ subtree, for
instance.