git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Absolutely. 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.
Previous: Đoàn Trần Công DanhNext: Đoàn Trần Công Danh
Message 4 of 6 in “allow "grep -E", remove {e,f}grep usage”
  1. 0/4 allow "grep -E", remove {e,f}grep usageĐoàn Trần Công Danh, Sep 21, 2022
  2. 1/4 CodingGuidelines: allow grep -EĐoàn Trần Công Danh, Sep 21, 2022
  3. 2/4 t: remove \{m,n\} from BRE grep usageĐoàn Trần Công Danh, Sep 21, 2022
  4. Junio C HamanoSep 21, 2022
  5. 3/4 t: convert egrep usage to "grep -E"Đoàn Trần Công Danh, Sep 21, 2022
  6. 4/4 t: convert fgrep usage to "grep -F"Đoàn Trần Công Danh, Sep 21, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.