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

Re: BUG: git grep behave oddly with alternatives

From
René Scharfe <l.s.r@web.de>
Date
Jan 3, 2023, 16:29 UTC
Message-ID
<634f47a8-b370-81cb-00e7-d93ffc7534a8@web.de>
In-Reply-To
<f82ae28a-fb56-8d1f-96c8-550b61439d3a@enterprisedb.com>
Am 03.01.23 um 10:53 schrieb Marco Nenciarini:
Show 18 quoted lines
> I've installed latest git from brew and suddenly git grep started behaving oddly when using alternatives.
>
> ```
> $ echo abd > test.file
> $ git grep --untracked 'a\(b\|c\)d' test.file
> $ git grep --untracked 'a\(b\)d' test.file
> test.file:abd
> ```
>
> It should have matched in both cases.
>
>
> If I switch to exented pattern it starts working again
>
> ```
> $ git grep --untracked -E 'a(b|c)d' test.file
> test.file:abd
> ```
This is expected: Basic regular expressions don't support alternation.
Under which circumstances did it work for you without -E or -P?
Show 16 quoted lines
>
> [System Info]
> git version:
> git version 2.39.0
> cpu: x86_64
> no commit associated with this build
> sizeof-long: 8
> sizeof-size_t: 8
> shell-path: /bin/sh
> feature: fsmonitor--daemon
> uname: Darwin 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:08:47 PST 2022; root:xnu-8792.61.2~4/RELEASE_X86_64 x86_64
> compiler info: clang: 14.0.0 (clang-1400.0.29.202)
> libc info: no libc information available
> $SHELL (typically, interactive shell): /usr/local/bin/bash
>
>
Previous: Marco NenciariniNext: Marco Nenciarini
Message 2 of 22 in “BUG: git grep behave oddly with alternatives”
  1. Marco NenciariniJan 3, 2023
  2. René ScharfeJan 3, 2023
  3. Marco NenciariniJan 3, 2023
  4. René ScharfeJan 3, 2023
  5. Junio C HamanoJan 4, 2023
  6. Jeff KingJan 4, 2023
  7. René ScharfeJan 4, 2023
  8. Jeff KingJan 6, 2023
  9. René ScharfeJan 8, 2023
  10. Junio C HamanoJan 8, 2023
  11. Jeff KingJan 11, 2023
  12. René ScharfeJan 12, 2023
  13. Ævar Arnfjörð BjarmasonJan 12, 2023
  14. Jeff KingJan 12, 2023
  15. Ævar Arnfjörð BjarmasonJan 13, 2023
  16. Junio C HamanoJan 13, 2023
  17. René ScharfeJan 14, 2023
  18. René ScharfeJan 14, 2023
  19. Diomidis SpinellisJan 14, 2023
  20. Junio C HamanoJan 14, 2023
  21. René ScharfeJan 13, 2023
  22. René ScharfeJan 13, 2023

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.