From: Nguyễn Thái Ngọc Duy Date: Wed, 10 Oct 2012 11:34:51 GMT Subject: Re: 'git grep needle rev' attempts to access 'rev:.../.gitattributes' in the worktree Message-ID: <1349868894-3579-1-git-send-email-pclouds@gmail.com> In-Reply-To: <7vk3uzfp3p.fsf@alter.siamese.dyndns.org> On Wed, Oct 10, 2012 at 1:59 AM, Junio C Hamano wrote: > Jeff King 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. Here we go. No additional tests as I don't know how to write them. But strace shows it's ok. Currently we don't have many options to optimize attr access. We cannot prepare a attr stack in advance for a specific directory, then check attributes many times using the stack. We cannot prepare attr stack from a tree object. As a result a normal "grep pattern --" results in a lot of duplicate failed open(".../.gitattributes") calls. Jeff King (1): grep: pass true path name to grep machinery Nguyễn Thái Ngọc Duy (2): quote: let caller reset buffer for quote_path_relative() grep: stop looking at random places for .gitattributes Documentation/git-grep.txt | 7 +++++-- builtin/clean.c | 2 ++ builtin/grep.c | 19 ++++++++++++------- builtin/ls-files.c | 1 + grep.c | 11 ++++++++--- grep.h | 4 +++- quote.c | 1 - wt-status.c | 1 + 8 files changed, 32 insertions(+), 14 deletions(-) -- 1.7.12.1.406.g6ab07c4