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

Re: [BUG/PATCH] git grep shows the same hit repeatedly for unmerged paths

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 6, 2007, 08:08 UTC
Message-ID
<7v3auggs8x.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<4757A4DD.901@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
Show 20 quoted lines
> Junio C Hamano schrieb:
>> When the index is unmerged, e.g.
>> 
>> 	$ git ls-files -u
>>         100644 faf413748eb6ccb15161a212156c5e348302b1b6 1	setup.c
>>         100644 145eca50f41d811c4c8fcb21ed2604e6b2971aba 2	setup.c
>>         100644 cb9558c49b6027bf225ba2a6154c4d2a52bcdbe2 3	setup.c
>> 
>> running "git grep" for work tree files repeats hits for each unmerged
>> stage.
>> 
>> 	$ git grep -n -e setup_work_tree -- '*.[ch]'
>>         setup.c:209:void setup_work_tree(void)
>>         setup.c:209:void setup_work_tree(void)
>>         setup.c:209:void setup_work_tree(void)
>> 
>> This should fix it.
>
> Does this change the behavior of grep --cached? IOW, listing the same hit
> more than once when --cached is given is a feature, IMHO.
Yeah, --cached should grep for each stage.  It doesn't?
Previous: Johannes SixtNext: Johannes Sixt
Message 3 of 5 in “git grep shows the same hit repeatedly for unmerged paths”
  1. git grep shows the same hit repeatedly for unmerged pathsJunio C Hamano, Dec 6, 2007
  2. Johannes SixtDec 6, 2007
  3. Junio C HamanoDec 6, 2007
  4. Johannes SixtDec 6, 2007
  5. Junio C HamanoDec 6, 2007

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.