Re: BUG: git grep behave oddly with alternatives

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/01/23 17:29, René Scharfe wrote:
Am 03.01.23 um 10:53 schrieb Marco Nenciarini:
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?


It has always worked until I installed 2.39.0 on my mac. I've also checked with other developers that are using a mac and they reports the same. On Linux it works regardless the git version.

Using grep directly also works, so it is a different behavior between grep and git grep, that is surprising.


[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




--
Marco Nenciarini - EnterpriseDB
marco.nenciarini@xxxxxxxxxxxxxxxx | www.enterprisedb.com




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux