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

Re: RFC "grep '...\{m,n\}"?

From
Duy Nguyen <pclouds@gmail.com>
Date
Jan 23, 2015, 00:39 UTC
Message-ID
<CACsJy8Boo4tBNDJjSP5Kv_e6WaE=Fg_dGzOHFDjd5HcX3D3r7A@mail.gmail.com>
In-Reply-To
<xmqqvbjysh4o.fsf_-_@gitster.dls.corp.google.com>
On Fri, Jan 23, 2015 at 3:19 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 39 quoted lines
> "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> writes:
>
>> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
>> index 8197ed29a9ec..a31f7e0430e1 100755
>> --- a/t/t3404-rebase-interactive.sh
>> +++ b/t/t3404-rebase-interactive.sh
>> @@ -1039,4 +1039,11 @@ test_expect_success 'short SHA-1 collide' '
>>       )
>>  '
>>
>> +test_expect_success 'respect core.abbrev' '
>> +     git config core.abbrev 12 &&
>> +     set_cat_todo_editor &&
>> +     test_must_fail git rebase -i HEAD~4 >todo-list &&
>> +     test 4 = $(grep -c "pick [0-9a-f]\{12,\}" todo-list)
>> +'
>
> Documentation/CodingGuidelines says
>
>  - As to use of grep, stick to a subset of BRE (namely, no \{m,n\},
>    [::], [==], or [..]) for portability.
>
>    - We do not use \{m,n\};
>
>    - We do not use -E;
>
>    - We do not use ? or + (which are \{0,1\} and \{1,\}
>      respectively in BRE) but that goes without saying as these
>      are ERE elements not BRE (note that \? and \+ are not even part
>      of BRE -- making them accessible from BRE is a GNU extension).
>
> but I see we have multiple hits from "git grep 'grep .*\\{'" (all in
> the t/ directory).  I wonder
>
>  - if everybody's system is now OK with \{m,n\} these days, or
>
>  - there are people who are grateful that we stayed away from using
>    \{m,n\} but they are not running the tests because their system
>    is too exotic to pass other parts of the test suite.

Can we switch to using git-grep in the test suite and avoid these platform issues? Or maybe switch to test-grep.c that is a wrapper of compat regex to make sure the same feature set is used across platforms.

-- 
Duy
Previous: Junio C Hamano
Message 8 of 8 in “rebase -i: respect core.abbrev for real”
  1. rebase -i: respect core.abbrev for realKirill A. Shutemov, Jan 19, 2015
  2. Eric SunshineJan 19, 2015
  3. [PATCHv2] rebase -i: respect core.abbrev for realKirill A. Shutemov, Jan 20, 2015
  4. Junio C HamanoJan 22, 2015
  5. [PATCHv3] rebase -i: respect core.abbrev for realKirill A. Shutemov, Jan 22, 2015
  6. Junio C HamanoJan 22, 2015
  7. RFC "grep '...\{m,n\}"?Junio C Hamano, Jan 22, 2015
  8. Duy NguyenJan 23, 2015

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.