aboutsummaryrefslogtreecommitdiffstats
path: root/userdiff.c
diff options
context:
space:
mode:
authorLucas Seiki Oshiro <lucasseikioshiro@gmail.com>2025-03-31 00:13:09 -0300
committerJunio C Hamano <gitster@pobox.com>2025-04-01 03:02:09 -0700
commit43380056df44aed6e074689dc8bc940f9dc6e2c8 (patch)
treeba5279cfaa2f82baceadb3b65d7c20d002952ca0 /userdiff.c
parentGit 2.49 (diff)
downloadgit-43380056df44aed6e074689dc8bc940f9dc6e2c8.tar.gz
git-43380056df44aed6e074689dc8bc940f9dc6e2c8.zip
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>
Diffstat (limited to 'userdiff.c')
-rw-r--r--userdiff.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/userdiff.c b/userdiff.c
index 340c4eb4f7..da75625020 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -211,6 +211,10 @@ PATTERNS("html",
"^[ \t]*(<[Hh][1-6]([ \t].*)?>.*)$",
/* -- */
"[^<>= \t]+"),
+PATTERNS("ini",
+ "^[ \t]*\\[[^]]+\\]",
+ /* -- */
+ "[^ \t]+"),
PATTERNS("java",
"!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
/* Class, enum, interface, and record declarations */