git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t4205: replace .\+ with ..* in sed commands
@ 2013-07-01 18:59 Brian Gernhardt
  2013-07-01 19:26 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Gernhardt @ 2013-07-01 18:59 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano

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.

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
 "
-- 
1.8.3.1.636.g893104c

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] t4205: replace .\+ with ..* in sed commands
  2013-07-01 18:59 [PATCH] t4205: replace .\+ with ..* in sed commands Brian Gernhardt
@ 2013-07-01 19:26 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2013-07-01 19:26 UTC (permalink / raw)
  To: Brian Gernhardt; +Cc: Git List

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.

>
> 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
>  "

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-01 19:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-01 18:59 [PATCH] t4205: replace .\+ with ..* in sed commands Brian Gernhardt
2013-07-01 19:26 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).