From 43380056df44aed6e074689dc8bc940f9dc6e2c8 Mon Sep 17 00:00:00 2001 From: Lucas Seiki Oshiro Date: Mon, 31 Mar 2025 00:13:09 -0300 Subject: 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 Helped-by: D. Ben Knoble Signed-off-by: Lucas Seiki Oshiro Signed-off-by: Junio C Hamano --- userdiff.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'userdiff.c') 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 */ -- cgit v1.2.3