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

Re: git grep doesn't follow symbolic link

From
Thomas Rast <trast@student.ethz.ch>
Date
Jan 10, 2012, 10:00 UTC
Message-ID
<877h0zlvwd.fsf@thomas.inf.ethz.ch>
In-Reply-To
<CALkWK0=-LZH4MYhX50v-RWpGA2r+6q50YxsKaOxc0mJ__yuK7g@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 9 quoted lines
> Hi Bertrand,
>
> Bertrand BENOIT wrote:
>> When using git grep, symbolic links are not followed.
>> Is it a wanted behavior ?
>
> I'd imagine so: symbolic links are not portable across different file
> systems; Git's internal representation of a symbolic link is a file
> containing the path of the file to be linked to.

I'd actually welcome a fix to this general area, for an entirely different reason. With bash and ordinary diff I can do things like

  diff -u <(ls) <(cd elsewhere && ls) | less
But I lose all the cute features of git-diff.  I *could* say
  git diff --no-index <(ls) <(cd elsewhere && ls)
and it helpfully tells me
  diff --git 1/dev/fd/63 2/dev/fd/62
  index 55ccbe5..d796c45 120000
  --- 1/dev/fd/63
  +++ 2/dev/fd/62
  @@ -1 +1 @@
  -pipe:[607341]
  \ No newline at end of file
  +pipe:[607343]
  \ No newline at end of file

Of course that's diff and not grep, but I think they suffer from the same flaw: they share the file-kind handling logic of the rest of git in a case where it's not very helpful.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Ramkumar RamachandraNext: Junio C Hamano
Message 3 of 10 in “git grep doesn't follow symbolic link”
  1. Bertrand BENOITJan 9, 2012
  2. Ramkumar RamachandraJan 10, 2012
  3. Thomas RastJan 10, 2012
  4. Junio C HamanoJan 10, 2012
  5. Nguyen Thai Ngoc DuyJan 14, 2012
  6. Junio C HamanoJan 15, 2012
  7. Nguyen Thai Ngoc DuyJan 15, 2012
  8. Junio C HamanoJan 16, 2012
  9. Nguyen Thai Ngoc DuyJan 17, 2012
  10. Junio C HamanoJan 17, 2012

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.