From: Lucas Seiki Oshiro Date: Wed, 19 Mar 2025 17:20:15 GMT Subject: [GSoC PATCH 1/2] userdiff: add builtin driver for gitconfig syntax Message-ID: <20250319172016.2115-2-lucasseikioshiro@gmail.com> In-Reply-To: <20250319172016.2115-1-lucasseikioshiro@gmail.com> From Documentation/config.adoc: """ The file consists of sections and variables. A section begins with the name of the section in square brackets and continues until the next section begins. Section names are case-insensitive. Only alphanumeric characters, `-` and `.` are allowed in section names. Each variable must belong to some section, which means that there must be a section header before the first setting of a variable. [...] Subsection names are case sensitive and can contain any characters except newline and the null byte. The variable names are case-insensitive, allow only alphanumeric characters and `-`, and must start with an alphabetic character. """ Then, add a new builtin driver for gitconfig files, where: - the funcname regular expression matches sections and subsections, i. e. the pattern [SECTION] or [SECTION "SUBSECTION"], where the section is composed by alphanumeric numbers, `-` and `.`, and subsection names may be composed by any characters; - word_regex is more permissive, matching any word with one or more non-whitespace characters. Signed-off-by: Lucas Seiki Oshiro --- userdiff.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/userdiff.c b/userdiff.c index 340c4eb4f7..5bbcc2b690 100644 --- a/userdiff.c +++ b/userdiff.c @@ -198,6 +198,10 @@ IPATTERN("fountain", "^((\\.[^.]|(int|ext|est|int\\.?/ext|i/e)[. ]).*)$", /* -- */ "[^ \t-]+"), +PATTERNS("gitconfig", + "^\\[[a-zA-Z0-9]+\\]|\\[[a-zA-Z0-9]+[ \t]+\".+\"\\]$", + /* -- */ + "[^ \t]+"), PATTERNS("golang", /* Functions */ "^[ \t]*(func[ \t]*.*(\\{[ \t]*)?)\n" -- 2.39.5 (Apple Git-154)