All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
To: "René Scharfe" <l.s.r@web.de>, git@vger.kernel.org
Subject: Re: BUG: git grep behave oddly with alternatives
Date: Tue, 3 Jan 2023 19:13:03 +0100	[thread overview]
Message-ID: <1f61b660-b2d0-ba93-3182-05a9ab97b00e@enterprisedb.com> (raw)
In-Reply-To: <634f47a8-b370-81cb-00e7-d93ffc7534a8@web.de>

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@enterprisedb.com | www.enterprisedb.com


  reply	other threads:[~2023-01-03 18:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-03  9:53 BUG: git grep behave oddly with alternatives Marco Nenciarini
2023-01-03 16:29 ` René Scharfe
2023-01-03 18:13   ` Marco Nenciarini [this message]
2023-01-03 20:52     ` René Scharfe
2023-01-04  6:13       ` Junio C Hamano
2023-01-04  7:46       ` Jeff King
2023-01-04 16:36         ` René Scharfe
2023-01-06  9:09           ` Jeff King
2023-01-08  0:42             ` René Scharfe
2023-01-08  1:27               ` Junio C Hamano
2023-01-11 18:56               ` Jeff King
2023-01-12 17:13                 ` René Scharfe
2023-01-12 17:52                   ` Ævar Arnfjörð Bjarmason
2023-01-12 21:54                   ` Jeff King
2023-01-13  8:28                     ` Ævar Arnfjörð Bjarmason
2023-01-13 17:19                       ` Junio C Hamano
2023-01-14  6:44                         ` René Scharfe
2023-01-14  8:31                           ` René Scharfe
2023-01-14 12:45                             ` Diomidis Spinellis
2023-01-14 16:08                               ` Junio C Hamano
2023-01-13 17:24                       ` René Scharfe
2023-01-13 23:03                         ` René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f61b660-b2d0-ba93-3182-05a9ab97b00e@enterprisedb.com \
    --to=marco.nenciarini@enterprisedb.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.