From: Junio C Hamano Date: Fri, 12 Oct 2012 16:47:07 GMT Subject: Re: [PATCH v3] grep: stop looking at random places for .gitattributes Message-ID: <7vfw5j4oz8.fsf@alter.siamese.dyndns.org> In-Reply-To: <1350038978-26153-1-git-send-email-pclouds@gmail.com> Nguyễn Thái Ngọc Duy writes: > grep searches for .gitattributes using "name" field in struct > grep_source but that field is not real on-disk path name. For example, > "grep pattern rev" fills the field with "rev:path", and Git looks for > .gitattributes in the (non-existent but exploitable) path "rev:path" > instead of "path". > > This patch passes real paths down to grep_source_load_driver() when: > > - grep on work tree > - grep on the index > - grep a commit (or a tag if it points to a commit) > > so that these cases look up .gitattributes at proper paths. > .gitattributes lookup is disabled in all other cases. > > Initial-work-by: Jeff King > Signed-off-by: Nguyễn Thái Ngọc Duy > --- Looks sensible and straightforward. Thanks.