diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-08-10 22:12:01 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-08-11 18:02:59 (GMT) |
commit | b6029b3279ef5997796de99ce9319a5f1499df21 (patch) | |
tree | b20c4dc6c2aa4af63570393c5a54a4664403d9e4 /userdiff.c | |
parent | ebf3c04b262aa27fbb97f8a0156c2347fecafafb (diff) | |
download | git-b6029b3279ef5997796de99ce9319a5f1499df21.zip git-b6029b3279ef5997796de99ce9319a5f1499df21.tar.gz git-b6029b3279ef5997796de99ce9319a5f1499df21.tar.bz2 |
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, and that may allow them to be simpler.
Text stolen mostly from, and further improved by, Johannes Sixt.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'userdiff.c')
-rw-r--r-- | userdiff.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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. The patterns + * can be simple without implementing all syntactical corner cases, as + * long as they are sufficiently permissive. + */ static struct userdiff_driver builtin_drivers[] = { IPATTERN("ada", "!^(.*[ \t])?(is[ \t]+new|renames|is[ \t]+separate)([ \t].*)?$\n" |