{"thread":{"id":"63220","subject":"[GSoC PATCH v3] userdiff: add builtin driver for INI files","startedAt":"2025-03-31T03:13:21Z","lastAt":"2025-03-31T07:38:39Z","messageCount":2,"participants":["Lucas Seiki Oshiro","Patrick Steinhardt"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"515313","messageId":"20250331031309.94682-1-lucasseikioshiro@gmail.com","threadId":"63220","inReplyTo":null,"subject":"[GSoC PATCH v3] userdiff: add builtin driver for INI files","fromName":"Lucas Seiki Oshiro","fromEmail":"lucasseikioshiro@gmail.com","sentAt":"2025-03-31T03:13:09Z","receivedAt":"2025-03-31T03:13:21Z","isPatch":true,"sender":{"key":"lucasseikioshiro@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12701580?v=4"},"body":"Add a new builtin driver for generic INI files (e. g. the gitconfig\nfiles), where:\n\n- the funcname regular expression matches section names, i. e. any\n  string between brackets at the beginning of the line, with or without\n  indentation;\n\n- word_regex matches any word with one or more non-whitespace\n  characters without checking if it is a valid variable name or value.\n\nAlso add tests for the new userdiff driver. These files define sections\nand subsections, with and without indentation.\n\nHelped-by: Patrick Steinhardt <ps@pks.im>\nHelped-by: D. Ben Knoble <ben.knoble@gmail.com>\nSigned-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>\n---\n\nThe previous versions were more focused on the gitconfig format. This\npatch generalizes for other INI files, such as the systemd .service files or\nthe Desktop.ini files on Windows.\n\n\n t/t4018/ini-section             |  5 +++++\n t/t4018/ini-section-noindent    |  5 +++++\n t/t4018/ini-section-same-line   |  4 ++++\n t/t4018/ini-subsection          | 12 ++++++++++++\n t/t4018/ini-subsection-noindent | 12 ++++++++++++\n userdiff.c                      |  4 ++++\n 6 files changed, 42 insertions(+)\n create mode 100644 t/t4018/ini-section\n create mode 100644 t/t4018/ini-section-noindent\n create mode 100644 t/t4018/ini-section-same-line\n create mode 100644 t/t4018/ini-subsection\n create mode 100644 t/t4018/ini-subsection-noindent\n\ndiff --git a/t/t4018/ini-section b/t/t4018/ini-section\nnew file mode 100644\nindex 0000000000..c895ad9b4f\n--- /dev/null\n+++ b/t/t4018/ini-section\n@@ -0,0 +1,5 @@\n+[RIGHT]\n+        # comment\n+        ; comment\n+        name = value\n+        ChangeMe\ndiff --git a/t/t4018/ini-section-noindent b/t/t4018/ini-section-noindent\nnew file mode 100644\nindex 0000000000..733d23c801\n--- /dev/null\n+++ b/t/t4018/ini-section-noindent\n@@ -0,0 +1,5 @@\n+[RIGHT]\n+# comment\n+; comment\n+name = value\n+ChangeMe\ndiff --git a/t/t4018/ini-section-same-line b/t/t4018/ini-section-same-line\nnew file mode 100644\nindex 0000000000..522a1fa4a1\n--- /dev/null\n+++ b/t/t4018/ini-section-same-line\n@@ -0,0 +1,4 @@\n+[RIGHT] name = value\n+        # comment\n+        ; comment\n+        ChangeMe\ndiff --git a/t/t4018/ini-subsection b/t/t4018/ini-subsection\nnew file mode 100644\nindex 0000000000..3d47349e60\n--- /dev/null\n+++ b/t/t4018/ini-subsection\n@@ -0,0 +1,12 @@\n+[LEFT]\n+\n+      [LEFT \"CENTER\"]\n+      # comment\n+      ; comment\n+      name = value\n+\n+      [LEFT \"RIGHT\"]\n+      # comment\n+      ; comment\n+      name = value\n+      ChangeMe\ndiff --git a/t/t4018/ini-subsection-noindent b/t/t4018/ini-subsection-noindent\nnew file mode 100644\nindex 0000000000..698ea00ea3\n--- /dev/null\n+++ b/t/t4018/ini-subsection-noindent\n@@ -0,0 +1,12 @@\n+[LEFT]\n+\n+[LEFT \"CENTER\"]\n+# comment\n+; comment\n+name = value\n+\n+[LEFT \"RIGHT\"]\n+# comment\n+; comment\n+name = value\n+ChangeMe\ndiff --git a/userdiff.c b/userdiff.c\nindex 340c4eb4f7..da75625020 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -211,6 +211,10 @@ PATTERNS(\"html\",\n \t \"^[ \\t]*(<[Hh][1-6]([ \\t].*)?>.*)$\",\n \t /* -- */\n \t \"[^<>= \\t]+\"),\n+PATTERNS(\"ini\",\n+\t \"^[ \\t]*\\\\[[^]]+\\\\]\",\n+\t /* -- */\n+\t \"[^ \\t]+\"),\n PATTERNS(\"java\",\n \t \"!^[ \\t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\\n\"\n \t /* Class, enum, interface, and record declarations */\n-- \n2.39.5 (Apple Git-154)\n\n"},{"id":"515330","messageId":"Z-pGdyh0eG3xSe4W@pks.im","threadId":"63220","inReplyTo":"20250331031309.94682-1-lucasseikioshiro@gmail.com","subject":"Re: [GSoC PATCH v3] userdiff: add builtin driver for INI files","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-03-31T07:38:31Z","receivedAt":"2025-03-31T07:38:39Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Mon, Mar 31, 2025 at 12:13:09AM -0300, Lucas Seiki Oshiro wrote:\n> Add a new builtin driver for generic INI files (e. g. the gitconfig\n> files), where:\n> \n> - the funcname regular expression matches section names, i. e. any\n>   string between brackets at the beginning of the line, with or without\n>   indentation;\n> \n> - word_regex matches any word with one or more non-whitespace\n>   characters without checking if it is a valid variable name or value.\n> \n> Also add tests for the new userdiff driver. These files define sections\n> and subsections, with and without indentation.\n> \n> Helped-by: Patrick Steinhardt <ps@pks.im>\n> Helped-by: D. Ben Knoble <ben.knoble@gmail.com>\n> Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>\n\nThis commit message reads quite nicely now. The changes also look\nsensible to me. Thanks, I've got nothing else to add!\n\nPatrick\n"}]}