Git fork

userdiff: add builtin driver for INI files

Add a new builtin driver for generic INI files (e. g. the gitconfig
files), where:

- the funcname regular expression matches section names, i. e. any
string between brackets at the beginning of the line, with or without
indentation;

- word_regex matches any word with one or more non-whitespace
characters without checking if it is a valid variable name or value.

Also add tests for the new userdiff driver. These files define sections
and subsections, with and without indentation.

Helped-by: Patrick Steinhardt <ps@pks.im>
Helped-by: D. Ben Knoble <ben.knoble@gmail.com>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Lucas Seiki Oshiro and committed by
Junio C Hamano
43380056 683c54c9

+42
+5
t/t4018/ini-section
··· 1 + [RIGHT] 2 + # comment 3 + ; comment 4 + name = value 5 + ChangeMe
+5
t/t4018/ini-section-noindent
··· 1 + [RIGHT] 2 + # comment 3 + ; comment 4 + name = value 5 + ChangeMe
+4
t/t4018/ini-section-same-line
··· 1 + [RIGHT] name = value 2 + # comment 3 + ; comment 4 + ChangeMe
+12
t/t4018/ini-subsection
··· 1 + [LEFT] 2 + 3 + [LEFT "CENTER"] 4 + # comment 5 + ; comment 6 + name = value 7 + 8 + [LEFT "RIGHT"] 9 + # comment 10 + ; comment 11 + name = value 12 + ChangeMe
+12
t/t4018/ini-subsection-noindent
··· 1 + [LEFT] 2 + 3 + [LEFT "CENTER"] 4 + # comment 5 + ; comment 6 + name = value 7 + 8 + [LEFT "RIGHT"] 9 + # comment 10 + ; comment 11 + name = value 12 + ChangeMe
+4
userdiff.c
··· 211 211 "^[ \t]*(<[Hh][1-6]([ \t].*)?>.*)$", 212 212 /* -- */ 213 213 "[^<>= \t]+"), 214 + PATTERNS("ini", 215 + "^[ \t]*\\[[^]]+\\]", 216 + /* -- */ 217 + "[^ \t]+"), 214 218 PATTERNS("java", 215 219 "!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n" 216 220 /* Class, enum, interface, and record declarations */