From: Johannes Sixt <j6t@kdbg.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Tassilo Horn <tsdh@gnu.org>, git@vger.kernel.org
Subject: Re: Re* [PATCH v4] userdiff: improve java hunk header regex
Date: Wed, 11 Aug 2021 09:14:13 +0200 [thread overview]
Message-ID: <157a0c35-1c82-9a2e-3bcd-ae6059ec71bd@kdbg.org> (raw)
In-Reply-To: <xmqq35rhc5la.fsf_-_@gitster.g>
Am 11.08.21 um 00:12 schrieb Junio C Hamano:
> Subject: userdiff: comment on the builtin patterns
>
> Remind developers that they do not need to go overboard to implement
> patterns to prepare for invalid constructs. They only have to be
> sufficiently permissive, assuming that the payload is syntactically
> correct.
>
> Text stolen mostly from Johannes Sixt.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> userdiff.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git c/userdiff.c w/userdiff.c
> index d9b2ba752f..1a6d27fda6 100644
> --- c/userdiff.c
> +++ w/userdiff.c
> @@ -13,6 +13,16 @@ static int drivers_alloc;
> #define IPATTERN(name, pattern, word_regex) \
> { name, NULL, -1, { pattern, REG_EXTENDED | REG_ICASE }, \
> word_regex "|[^[:space:]]|[\xc0-\xff][\x80-\xbf]+" }
> +
> +/*
> + * Built-in drivers for various languages, sorted by their names
> + * (except that the "default" is left at the end).
> + *
> + * When writing or updating patterns, assume that the contents these
> + * patterns are applied to are syntactically correct. You do not have
> + * to implement all syntactical corner cases---the patterns have to be
> + * sufficiently permissive.
> + */
IMO, as written, the comment falls short of suggesting that patterns can
be simple. How about appending "and can be simple"?
> static struct userdiff_driver builtin_drivers[] = {
> IPATTERN("ada",
> "!^(.*[ \t])?(is[ \t]+new|renames|is[ \t]+separate)([ \t].*)?$\n"
>
next prev parent reply other threads:[~2021-08-11 7:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-10 19:09 [PATCH v4] userdiff: improve java hunk header regex Tassilo Horn
2021-08-10 20:57 ` Johannes Sixt
2021-08-10 22:12 ` Re* " Junio C Hamano
2021-08-11 7:14 ` Johannes Sixt [this message]
2021-08-11 16:04 ` Junio C Hamano
2021-08-11 20:32 ` Johannes Sixt
2021-08-11 5:22 ` Tassilo Horn
2021-08-11 7:34 ` Johannes Sixt
2021-08-11 7:39 ` Tassilo Horn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=157a0c35-1c82-9a2e-3bcd-ae6059ec71bd@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=tsdh@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).