Re: Bug: Git grep -f reads the filename relative to the repository root
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Oct 30, 2023, 21:58 UTC
- Message-ID
- <ZUAnEVk65VQQE263@nand.local>
- In-Reply-To
- <xmqqedhzg37z.fsf@gitster.g>
On Thu, Oct 12, 2023 at 10:28:16AM -0700, Junio C Hamano wrote:
Show 20 quoted lines
> Erik Cervin Edin <erik@cervined.in> writes: > > > In the Git repository, I ran > > > > echo tig > pattern-file && > > echo git > xdiff/pattern-file && > > cd xdfiff && > > git grep -f pattern-file > > > > What did you expect to happen? (Expected behavior) > > > > Git grep -f to read the pattern-file, in the xdiff directory and > > search for lines matching `git` in the xdiff directory. > > That does sound like a bug. It should use the original directory as > the base of the relative path computation, similar to the way how > OPT_FILENAME() options are handled. > > Perhaps something along this line, but this is not even compile > tested yet.
Just going through old mail that I didn't have a chance to respond to, the proposed patch that you included here does compile and pass t7810 for me, and the fix looks reasonable as-is. I don't think I see this patch on master, but would have no objections to you merging it down.
Thanks, Taylor