Re: [PATCH v2 02/10] t4207: test coloring of grafted decorations
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Aug 3, 2022, 06:44 UTC
- Message-ID
- <CAPig+cTUTXuBov4m0xvxehVFbbPjVPrAHAFfPWO5Yv4C9imyaQ@mail.gmail.com>
- In-Reply-To
- <220803.86y1w5g7r0.gmgdl@evledraar.gmail.com>
On Wed, Aug 3, 2022 at 2:32 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> On Fri, Jul 29 2022, Derrick Stolee via GitGitGadget wrote:
> > + sed "s/[0-9a-f]\{10,10\}/COMMIT_ID/" |
>
> {10,10} in a regex is just {10}, no?I'm more than a little surprised that this regex repeat-count notation works on macOS `sed` which, in the BSD tradition, is rather feature poor. Testing it, though, I find that it does work, even on my relatively old version of macOS. However, I'd still worry about other BSD `sed`s in the wild.
Instead of using the repeat-count notation, we could model this after the way `OID_REGEX` is defined in t/test-lib.sh which, through automation, defines a highly portable regex. Alternatively, just use "$_x05$_x05", also from test-lib.sh, to define a regex matcher for ten hex digits.