diff mbox series

[v2] userdiff: remove empty subexpression from elixir regex

Message ID 20191213175535.87725-1-emaste@FreeBSD.org (mailing list archive)
State New, archived
Headers show
Series [v2] userdiff: remove empty subexpression from elixir regex | expand

Commit Message

Ed Maste Dec. 13, 2019, 5:55 p.m. UTC
The regex failed to compile on FreeBSD.

Fixes: a807200f67588f6e
Signed-off-by: Ed Maste <emaste@FreeBSD.org>
---
Add /* -- */ to make things more clear and be consistent with other
patterns.

 userdiff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ed Maste Dec. 13, 2019, 3:58 p.m. UTC | #1
On Fri, 13 Dec 2019 at 14:24, Johannes Sixt <j6t@kdbg.org> wrote:
>
> Am 13.12.19 um 18:55 schrieb Ed Maste:
> > The regex failed to compile on FreeBSD.
> >
> > Fixes: a807200f67588f6e
>
> Having a references is this form is unusual for our codebase. (Not that
> I mind a lot, though.) I expect that Junio will commit the fix on top of
> the commit that introduced the bogus regex anyway (branch
> ln/userdiff-elixir), and then it will be easy find.

Ok, I picked this up from the Linux kernel where someone added a
Fixes: tag to one of my changes (which had the hash of the original
change as part of the commit message body).

> > Signed-off-by: Ed Maste <emaste@FreeBSD.org>
> > ---
> > Add /* -- */ to make things more clear and be consistent with other
> > patterns.
>
> This text would be nice to have in the commit message.

Ah, I didn't think it was remarkable (it's consistent with all of the
existing entries) but the change is indeed broader than what the
commit message implies. I'm happy to send a v3 with an amended commit
message if that's desired.
Jeff King Dec. 13, 2019, 6:18 p.m. UTC | #2
On Fri, Dec 13, 2019 at 05:55:35PM +0000, Ed Maste wrote:

> The regex failed to compile on FreeBSD.
> 
> Fixes: a807200f67588f6e
> Signed-off-by: Ed Maste <emaste@FreeBSD.org>
> ---
> Add /* -- */ to make things more clear and be consistent with other
> patterns.

Thanks, this looks good to me.

-Peff
Johannes Sixt Dec. 13, 2019, 7:24 p.m. UTC | #3
Am 13.12.19 um 18:55 schrieb Ed Maste:
> The regex failed to compile on FreeBSD.
> 
> Fixes: a807200f67588f6e

Having a references is this form is unusual for our codebase. (Not that
I mind a lot, though.) I expect that Junio will commit the fix on top of
the commit that introduced the bogus regex anyway (branch
ln/userdiff-elixir), and then it will be easy find.

> Signed-off-by: Ed Maste <emaste@FreeBSD.org>
> ---
> Add /* -- */ to make things more clear and be consistent with other
> patterns.

This text would be nice to have in the commit message.

> 
>  userdiff.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/userdiff.c b/userdiff.c
> index 324916f20f..efbe05e5a5 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -34,8 +34,9 @@ PATTERNS("dts",
>  	 "|[-+*/%&^|!~]|>>|<<|&&|\\|\\|"),
>  PATTERNS("elixir",
>  	 "^[ \t]*((def(macro|module|impl|protocol|p)?|test)[ \t].*)$",
> +	 /* -- */
>  	 /* Atoms, names, and module attributes */
> -	 "|[@:]?[a-zA-Z0-9@_?!]+"
> +	 "[@:]?[a-zA-Z0-9@_?!]+"
>  	 /* Numbers with specific base */
>  	 "|[-+]?0[xob][0-9a-fA-F]+"
>  	 /* Numbers */
> 

Good catch!

Tested-by: Johannes Sixt <j6t@kdbg.org>

Thanks!

-- Hannes
Junio C Hamano Dec. 13, 2019, 8:23 p.m. UTC | #4
Ed Maste <emaste@freebsd.org> writes:

>> > Add /* -- */ to make things more clear and be consistent with other
>> > patterns.
>>
>> This text would be nice to have in the commit message.
>
> Ah, I didn't think it was remarkable (it's consistent with all of the
> existing entries) but the change is indeed broader than what the
> commit message implies. I'm happy to send a v3 with an amended commit
> message if that's desired.

Let's save one round-trip, then.  Here is what I will queue on the
'pu' branch.

Thanks, all.

-- >8 --
From: Ed Maste <emaste@FreeBSD.org>
Date: Fri, 13 Dec 2019 17:55:35 +0000
Subject: [PATCH] userdiff: remove empty subexpression from elixir regex

The regex failed to compile on FreeBSD.

Also add /* -- */ mark to separate the two regex entries given to
the PATTERNS() macro, to make it consistent with patterns for other
content types.

Signed-off-by: Ed Maste <emaste@FreeBSD.org>
Reviewed-by: Jeff King <peff@peff.net>
Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 userdiff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/userdiff.c b/userdiff.c
index 577053c10a..0eb34bcd76 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -34,8 +34,9 @@ PATTERNS("dts",
 	 "|[-+*/%&^|!~]|>>|<<|&&|\\|\\|"),
 PATTERNS("elixir",
 	 "^[ \t]*((def(macro|module|impl|protocol|p)?|test)[ \t].*)$",
+	 /* -- */
 	 /* Atoms, names, and module attributes */
-	 "|[@:]?[a-zA-Z0-9@_?!]+"
+	 "[@:]?[a-zA-Z0-9@_?!]+"
 	 /* Numbers with specific base */
 	 "|[-+]?0[xob][0-9a-fA-F]+"
 	 /* Numbers */
diff mbox series

Patch

diff --git a/userdiff.c b/userdiff.c
index 324916f20f..efbe05e5a5 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -34,8 +34,9 @@  PATTERNS("dts",
 	 "|[-+*/%&^|!~]|>>|<<|&&|\\|\\|"),
 PATTERNS("elixir",
 	 "^[ \t]*((def(macro|module|impl|protocol|p)?|test)[ \t].*)$",
+	 /* -- */
 	 /* Atoms, names, and module attributes */
-	 "|[@:]?[a-zA-Z0-9@_?!]+"
+	 "[@:]?[a-zA-Z0-9@_?!]+"
 	 /* Numbers with specific base */
 	 "|[-+]?0[xob][0-9a-fA-F]+"
 	 /* Numbers */