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

Re: [PATCH] t4205: replace .\+ with ..* in sed commands

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 1, 2013, 19:26 UTC
Message-ID
<7vtxkef5ed.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1372705199-17679-1-git-send-email-brian@gernhardtsoftware.com>
Brian Gernhardt <brian@gernhardtsoftware.com> writes:
> OS X's sed only accepts basic regular expressions, which does not
> allow the + quantifier.  However '..*' (anything, followed by zero or
> more anything) is the same as '.\+' (one or more anything) and valid
> in any regular expression language.
Thanks for spotting this.

We shouldn't mark this as "OS X's sed is broken", but as "We try to stick to POSIX BRE, and calling ERE elements via backslash escape, e.g. \+, is a GNU extension we try to avoid". Obviously we are not always careful and sometimes these slip through the review process.

Show 28 quoted lines
>
> Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
> ---
>  t/t4205-log-pretty-formats.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
> index 719d132..3cfb744 100755
> --- a/t/t4205-log-pretty-formats.sh
> +++ b/t/t4205-log-pretty-formats.sh
> @@ -192,7 +192,7 @@ test_expect_success 'left alignment formatting with trunc' "
>  message ..
>  message ..
>  add bar  Z
> -$(commit_msg "" "8" ".\+$")
> +$(commit_msg "" "8" "..*$")
>  EOF
>  	test_cmp expected actual
>  "
> @@ -310,7 +310,7 @@ test_expect_success 'left/right alignment formatting with stealing' "
>  short long  long long
>  message ..   A U Thor
>  add bar      A U Thor
> -$(commit_msg "" "8" ".\+$")   A U Thor
> +$(commit_msg "" "8" "..*$")   A U Thor
>  EOF
>  	test_cmp expected actual
>  "
Previous: Brian Gernhardt
Message 2 of 2 in “t4205: replace .\+ with ..* in sed commands”
  1. t4205: replace .\+ with ..* in sed commandsBrian Gernhardt, Jul 1, 2013
  2. Junio C HamanoJul 1, 2013

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.