Re: 'git grep needle rev' attempts to access 'rev:.../.gitattributes' in the worktree
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 10, 2012, 05:33 UTC
- Message-ID
- <7vwqyydh6v.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CACsJy8Cku-XTbQBDpZpPh7AMDFMoNKLKeJNs5HKCQnBy420d2w@mail.gmail.com>
Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
Show 14 quoted lines
> On Wed, Oct 10, 2012 at 1:59 AM, Junio C Hamano <gitster@pobox.com> wrote: >> Jeff King <peff@peff.net> writes: >> >>> I think we just need to have callers of grep_source_init provide us with >>> the actual pathname (or NULL, in the case of GREP_SOURCE_BUF). That is >>> where the information is lost. >> >> Yes. I agree that is the right approach. > > Passing full path this way means prepare_attr_stack has to walk back > to top directory for every files (even in the same directory). If > .gitattributes are loaded while git-grep traverses the tree, then it > can preload attr once per directory. But Jeff's approach looks > simpler.
Why can't you do both? That is, to build a full path as you descend, and read per-directory .gitattributes as you go?
Confused...