From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Mario Grgic <mario_grgic@hotmail.com>,
demerphq <demerphq@gmail.com>,
git@vger.kernel.org
Subject: Re: git bug: Perl compatible regular expressions do not work as expected
Date: Mon, 27 Mar 2023 09:29:14 -0700 [thread overview]
Message-ID: <xmqqh6u6cg4l.fsf@gitster.g> (raw)
In-Reply-To: <eba23dc4-c036-fd1b-a1f0-028e8fff602b@web.de> ("René Scharfe"'s message of "Sat, 25 Mar 2023 19:09:35 +0100")
René Scharfe <l.s.r@web.de> writes:
> Am 25.03.23 um 14:09 schrieb Mario Grgic:
>> The lowercase -p is to print the output in patch format. You can rewrite the command line as
>>
>> git log --all --patch --perl-regexp -G '\bmain\b’
>>
>> I still get no output in any git version after 2.38.4
>
> -G doesn't support Perl regular expressions. --perl-regexp only affects
> --grep, --grep-reflog, --author, and --committer. Neither POSIX basic
> nor extended regular expressions support \b as word boundary. GNU regex
> and our compat/regex/ do, as extensions. macOS regex supports it if the
> flag REG_ENHANCED is given to regcomp(3).
Good summary to unconfuse speculations in the thread.
> So perhaps this is rather a feature request to support Perl regular
> expressions for -G (and probably -S as well).
Perhaps. I used to be a "it would be wonderful if pcre were usable
everywhere" dreamer, but after seeing our share of bugs caused by
use of pcre, I am not a huge proponent anymore. I do not object to
such an enhancement at all, as long as it is done cleanly and in
such a way that it is clear pcre cannot be used by accident when the
user does not ask for it.
> Or to enable REG_ENHANCED
> for them, at least, like 54463d32ef (use enhanced basic regular
> expressions on macOS, 2023-01-08) did to get alternations for git grep
> on macOS.
This one sounds like a reasonable thing, which may not have huge
unintended fallout, to do. I am a bit surprised that we have to
cover each individual callsite of regcomp(3), though. Doesn't the
54463d32ef fix use "#define regcomp git_regcomp" to cover everybody?
next prev parent reply other threads:[~2023-03-27 16:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-25 12:31 git bug: Perl compatible regular expressions do not work as expected Mario Grgic
2023-03-25 12:42 ` Kristoffer Haugsbakk
2023-03-25 12:59 ` Mario Grgic
2023-03-25 13:04 ` demerphq
2023-03-25 13:09 ` Mario Grgic
2023-03-25 13:24 ` demerphq
2023-03-25 18:09 ` René Scharfe
2023-03-27 16:29 ` Junio C Hamano [this message]
2023-03-27 17:23 ` René Scharfe
2023-03-27 21:33 ` Junio C Hamano
2023-03-28 13:47 ` Junio C Hamano
2023-03-28 17:56 ` René Scharfe
2023-03-25 14:16 ` Mario Grgic
2023-03-25 15:39 ` Mario Grgic
2023-03-27 16:30 ` Junio C Hamano
2023-03-27 17:22 ` Mario Grgic
2023-03-27 21:11 ` Junio C Hamano
2023-03-28 0:03 ` Mario Grgic
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=xmqqh6u6cg4l.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=demerphq@gmail.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=mario_grgic@hotmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox