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

Re: git grep bug replacing - with :

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 14, 2024, 21:05 UTC
Message-ID
<xmqqbk43dyln.fsf@gitster.g>
In-Reply-To
<CAPig+cRGnAcfpr4JWp9WWC0b4yvjKx-_0up_S2iaXCBxgcSLjQ@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 16 quoted lines
> On Fri, Jun 14, 2024 at 3:22 PM Rickard Andersson
> <rickard.a1992@gmail.com> wrote:
>> What did you do before the bug happened? (Steps to reproduce your issue)
>>    Added 2 files to my repo with words in them
>>    text-file.txt
>>    text-file-file.txt
>>    ```
>>    git grep -l ExtremelyInterestingWord
>>    ```
>>
>> What happened instead? (Actual behavior)
>>    I get
>>    ```
>>    text:file.txt
>>    text:file-file.txt
>>    ```

If the command line were "git grep -l <pattern> text", and there is a branch whose name is "text", and in the top level tree of that "text" branch's commit there are file.txt and file-file.txt both of which have the pattern, the symptom observed may appear.

But ...
Show 18 quoted lines
> I am unable to reproduce this problem:
>
>     $ git version
>     git version 2.45.2
>     $ git init foo
>     Initialized empty Git repository in .../foo/.git/
>     $ cd foo
>     $ echo ExtremelyInterestingWord >text-file.txt
>     $ echo ExtremelyInterestingWord >text-file-file.txt
>     $ git add text-file.txt text-file-file.txt
>     $ git commit -m msg
>     [main (root-commit) 765269f] msg
>      2 files changed, 2 insertions(+)
>      create mode 100644 text-file-file.txt
>      create mode 100644 text-file.txt
>     $ git grep -l ExtremelyInterestingWord
>     text-file-file.txt
>     text-file.txt

... with your (i.e. Eric's) reproduction setup, which agrees with the way how I interpreted the problem description in the original report, I do not see there is any other possible output from it.

Thanks.
Previous: Eric SunshineNext: Rickard Andersson
Message 3 of 5 in “git grep bug replacing - with :”
  1. Rickard AnderssonJun 14, 2024
  2. Eric SunshineJun 14, 2024
  3. Junio C HamanoJun 14, 2024
  4. Rickard AnderssonJun 15, 2024
  5. Eric SunshineJun 15, 2024

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.