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

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

From
GSGeorge Spelvin <linux@horizon.com>
Date
Jan 15, 2009, 22:29 UTC
Message-ID
<20090115222905.8157.qmail@science.horizon.com>

Could someone fix this some day? "git grep <pattern> ../include" is something I find myself wanting quite frequently, and it's a fresh annoyance every time I type it to discover that it still doesn't work.

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"), but a second idea dawned on me: interpret absolute pathnames as relative to the root of the repository. So I could "git grep <pattern> /" or "git grep <pattern> /include" from any subdirectory.

As it is currently, absolute pathnames don't work very well either... [1]$ git grep xyzzy $PWD fatal: '/home/linux/project/src' is outside repository [2]$ cd /usr/src/linux [3]$ git grep xyzzy $PWD CREDITS:E: rjd@xyzzy.clara.co.uk drivers/hwmon/hwmon-vid.c: * With assistance from Trent Piepho <xyzzy@speakeasy. drivers/infiniband/hw/ipath/ipath_debug.h: * if(infinipath_debug & _IPATH_xyzzy) drivers/media/dvb/frontends/or51132.c: * Copyright (C) 2007 Trent Piepho <xyz drivers/media/video/cx88/cx88-alsa.c: * (c) 2007 Trent Piepho <xyzzy@speakeas drivers/video/intelfb/intelfbhw.c: /* do some funky magic - xyzzy */ include/linux/byteorder/swab.h: * Trent Piepho <xyzzy@speakeasy.org> 2007114 include/linux/hwmon-vid.h: With assistance from Trent Piepho <xyzzy@speakeasy [4]$ cd include [5]$ git grep xyzzy $PWD fatal: git grep: cannot generate relative filenames containing '..'

I don't quite understand that last error message.
Thank you.
Next: Markus Heidelberg
Message 1 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.