git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: fatal: git grep: cannot generate relative filenames containing '..'

From
HKHannu Koivisto <azure@iki.fi>
Date
Jan 17, 2009, 02:21 UTC
Message-ID
<83vdsefz9j.fsf@kalahari.s2.org>
In-Reply-To
<7vr634ow3r.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> "George Spelvin" <linux@horizon.com> writes:
>
>> Could someone fix this some day?
>
> As far as I know you are the first to ask for this, so perhaps people never
> considered this was something to "fix"....

I for one have faced that problem and considered it something that would be nice to have fixed. Then again, I consider the default behaviour (when you pass no path) a bigger usability problem.

>> While you're at it, an option to search the entire git tree rather than
>> the current subdirectory would also be useful.  I was thinking about
>> a flag like -r (for "root"),...

It turns out that this "entire git tree" is practically my only use case when using normal (find and) grep and when I first tried git grep, I actually expected it to do just that with no path specified.

Why? Because of the way at least git diff and git log work. I thought that just like with them, "git grep foo" would search the entire git tree and I would have to say "git grep foo ." to limit to the current directory and its subdirectories. git-grep(1)'s "Look for specified patterns in the working tree files..." at least didn't seem to disagree with my expectation so I was a bit puzzled.

So I'd rather see git grep behave in a way consistent with git log and git diff (I realize that would change current behaviour instead of extending it).

-- 
Hannu
Previous: Jon LoeligerNext: George Spelvin
Message 5 of 11 in “fatal: git grep: cannot generate relative filenames containing '..'”
  1. George SpelvinJan 15, 2009
  2. Markus HeidelbergJan 15, 2009
  3. Junio C HamanoJan 16, 2009
  4. Jon LoeligerJan 16, 2009
  5. Hannu KoivistoJan 17, 2009
  6. George SpelvinJan 18, 2009
  7. Johannes SchindelinJan 16, 2009
  8. Junio C HamanoJan 16, 2009
  9. George SpelvinJan 16, 2009
  10. George SpelvinJan 16, 2009
  11. SZEDER GáborJan 16, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.