Subject: Re: [PATCH v2 2/4] t: remove \{m,n\} from BRE grep usage

From: Junio C Hamano <[email-masked]>
Date: Wed, 21 Sep 2022 11:06:56 -0700

Đoàn Trần Công Danh  <[email-masked]> writes:

> 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=sha256

Absolutely.  This alone is a change worth doing regardless of the
portability issues.

> Signed-off-by: Đoàn Trần Công Danh <[email-masked]>
> ---
>
>  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.