Re: [PATCH v2 2/4] t: remove \{m,n\} from BRE grep usage
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 21, 2022, 18:06 UTC
- Message-ID
- <xmqqpmfo38lb.fsf@gitster.g>
- In-Reply-To
- <ebaf6cec07e3a07c969c456e93aa9d4464f75548.1663765176.git.congdanhqx@gmail.com>
Đoàn Trần Công Danh <congdanhqx@gmail.com> writes:
Show 5 quoted lines
> The CodingGuidelines says we should avoid \{m,n\} in BRE usage.
> And their usages in our code base is limited, and subjectively
> hard to read.
>
> Replace them with ERE.OK. I do not personally mind allowing \{0,1\} in BRE (which would give us a portable way to express '?'), but we are not forbidding ERE in any way, so I am OK with the direction.
> Except for "0\{40\}" which would be changed to "$ZERO_OID",
> which is a better value for testing with:
> GIT_TEST_DEFAULT_HASH=sha256Absolutely. This alone is a change worth doing regardless of the portability issues.
Show 11 quoted lines
> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
> ---
>
> Phillip Wood said:
> > \{m,n\} is valid in a posix BRE[1]. If we're already using it without
> > anyone
> > complaining I think it would be better to update CodingGuidlines to allow
> > it.
>
> Yes, I agree. However, I think our usage of \{m,n\} is limited.
> Let's skip the lifting for now.OK.