{"thread":{"id":"63165","subject":"[GSoC PATCH 0/2] add userdiff driver for gitconfig","startedAt":"2025-03-19T17:20:23Z","lastAt":"2025-03-23T16:08:18Z","messageCount":7,"participants":["Lucas Seiki Oshiro","Patrick Steinhardt","D. Ben Knoble"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"514668","messageId":"20250319172016.2115-1-lucasseikioshiro@gmail.com","threadId":"63165","inReplyTo":null,"subject":"[GSoC PATCH 0/2] add userdiff driver for gitconfig","fromName":"Lucas Seiki Oshiro","fromEmail":"lucasseikioshiro@gmail.com","sentAt":"2025-03-19T17:20:14Z","receivedAt":"2025-03-19T17:20:23Z","isPatch":true,"sender":{"key":"lucasseikioshiro@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12701580?v=4"},"body":"Hi!\n\nHere's a simple patch, adding a userdiff driver for gitconfig files. This can be\nuseful for people who use Git for versioning configuration files, like a\ndotfiles repository.\n\nThis patchset also includes tests for it.\n\nLucas Seiki Oshiro (2):\n  userdiff: add builtin driver for gitconfig syntax\n  t4018: add tests for gitconfig in userdiff\n\n t/t4018/gitconfig-section             | 5 +++++\n t/t4018/gitconfig-section-noindent    | 5 +++++\n t/t4018/gitconfig-subsection          | 7 +++++++\n t/t4018/gitconfig-subsection-noindent | 7 +++++++\n userdiff.c                            | 4 ++++\n 5 files changed, 28 insertions(+)\n create mode 100644 t/t4018/gitconfig-section\n create mode 100644 t/t4018/gitconfig-section-noindent\n create mode 100644 t/t4018/gitconfig-subsection\n create mode 100644 t/t4018/gitconfig-subsection-noindent\n\n-- \n2.39.5 (Apple Git-154)\n\n"},{"id":"514669","messageId":"20250319172016.2115-2-lucasseikioshiro@gmail.com","threadId":"63165","inReplyTo":"20250319172016.2115-1-lucasseikioshiro@gmail.com","subject":"[GSoC PATCH 1/2] userdiff: add builtin driver for gitconfig syntax","fromName":"Lucas Seiki Oshiro","fromEmail":"lucasseikioshiro@gmail.com","sentAt":"2025-03-19T17:20:15Z","receivedAt":"2025-03-19T17:20:27Z","isPatch":true,"sender":{"key":"lucasseikioshiro@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12701580?v=4"},"body":"From Documentation/config.adoc:\n\n\"\"\"\nThe file consists of sections and variables. A section begins with\nthe name of the section in square brackets and continues until the next\nsection begins. Section names are case-insensitive. Only alphanumeric\ncharacters, `-` and `.` are allowed in section names. Each variable\nmust belong to some section, which means that there must be a section\nheader before the first setting of a variable.\n\n[...]\n\nSubsection names are case sensitive and can contain any characters except\nnewline and the null byte.\n\nThe variable names are case-insensitive, allow only alphanumeric characters\nand `-`, and must start with an alphabetic character.\n\"\"\"\n\nThen, add a new builtin driver for gitconfig files, where:\n\n- the funcname regular expression matches sections and subsections,\n  i. e. the pattern [SECTION] or [SECTION \"SUBSECTION\"], where the\n  section is composed by alphanumeric numbers, `-` and `.`, and\n  subsection names may be composed by any characters;\n\n- word_regex is more permissive, matching any word with one or more\n  non-whitespace characters.\n\nSigned-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>\n---\n userdiff.c | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/userdiff.c b/userdiff.c\nindex 340c4eb4f7..5bbcc2b690 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -198,6 +198,10 @@ IPATTERN(\"fountain\",\n \t \"^((\\\\.[^.]|(int|ext|est|int\\\\.?/ext|i/e)[. ]).*)$\",\n \t /* -- */\n \t \"[^ \\t-]+\"),\n+PATTERNS(\"gitconfig\",\n+         \"^\\\\[[a-zA-Z0-9]+\\\\]|\\\\[[a-zA-Z0-9]+[ \\t]+\\\".+\\\"\\\\]$\",\n+         /* -- */\n+         \"[^ \\t]+\"),\n PATTERNS(\"golang\",\n \t /* Functions */\n \t \"^[ \\t]*(func[ \\t]*.*(\\\\{[ \\t]*)?)\\n\"\n-- \n2.39.5 (Apple Git-154)\n\n"},{"id":"514670","messageId":"20250319172016.2115-3-lucasseikioshiro@gmail.com","threadId":"63165","inReplyTo":"20250319172016.2115-1-lucasseikioshiro@gmail.com","subject":"[GSoC PATCH 2/2] t4018: add tests for gitconfig in userdiff","fromName":"Lucas Seiki Oshiro","fromEmail":"lucasseikioshiro@gmail.com","sentAt":"2025-03-19T17:20:16Z","receivedAt":"2025-03-19T17:20:31Z","isPatch":true,"sender":{"key":"lucasseikioshiro@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12701580?v=4"},"body":"Add userdiff tests for gitconfig files. These files define sections and\nsubsections, with and without indentation.\n\nSigned-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>\n---\n t/t4018/gitconfig-section             | 5 +++++\n t/t4018/gitconfig-section-noindent    | 5 +++++\n t/t4018/gitconfig-subsection          | 7 +++++++\n t/t4018/gitconfig-subsection-noindent | 7 +++++++\n 4 files changed, 24 insertions(+)\n create mode 100644 t/t4018/gitconfig-section\n create mode 100644 t/t4018/gitconfig-section-noindent\n create mode 100644 t/t4018/gitconfig-subsection\n create mode 100644 t/t4018/gitconfig-subsection-noindent\n\ndiff --git a/t/t4018/gitconfig-section b/t/t4018/gitconfig-section\nnew file mode 100644\nindex 0000000000..866aa70b24\n--- /dev/null\n+++ b/t/t4018/gitconfig-section\n@@ -0,0 +1,5 @@\n+[RIGHT]\n+        # comment\n+        ; comment\n+        name = value\n+        ChangeMe\n\\ No newline at end of file\ndiff --git a/t/t4018/gitconfig-section-noindent b/t/t4018/gitconfig-section-noindent\nnew file mode 100644\nindex 0000000000..75a401b24b\n--- /dev/null\n+++ b/t/t4018/gitconfig-section-noindent\n@@ -0,0 +1,5 @@\n+[RIGHT]\n+# comment\n+; comment\n+name = value\n+ChangeMe\n\\ No newline at end of file\ndiff --git a/t/t4018/gitconfig-subsection b/t/t4018/gitconfig-subsection\nnew file mode 100644\nindex 0000000000..06243db626\n--- /dev/null\n+++ b/t/t4018/gitconfig-subsection\n@@ -0,0 +1,7 @@\n+[LEFT]\n+\n+[LEFT \"RIGHT\"]\n+      # comment\n+      ; comment\n+      name = value\n+      ChangeMe\n\\ No newline at end of file\ndiff --git a/t/t4018/gitconfig-subsection-noindent b/t/t4018/gitconfig-subsection-noindent\nnew file mode 100644\nindex 0000000000..a100b81cf1\n--- /dev/null\n+++ b/t/t4018/gitconfig-subsection-noindent\n@@ -0,0 +1,7 @@\n+[LEFT]\n+\n+[LEFT \"RIGHT\"]\n+# comment\n+; comment\n+name = value\n+ChangeMe\n\\ No newline at end of file\n-- \n2.39.5 (Apple Git-154)\n\n"},{"id":"514722","messageId":"Z9vT-dqBzXxzXnlU@pks.im","threadId":"63165","inReplyTo":"20250319172016.2115-2-lucasseikioshiro@gmail.com","subject":"Re: [GSoC PATCH 1/2] userdiff: add builtin driver for gitconfig syntax","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-03-20T08:38:17Z","receivedAt":"2025-03-20T08:38:26Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Mar 19, 2025 at 02:20:15PM -0300, Lucas Seiki Oshiro wrote:\n> From Documentation/config.adoc:\n> \n> \"\"\"\n> The file consists of sections and variables. A section begins with\n> the name of the section in square brackets and continues until the next\n> section begins. Section names are case-insensitive. Only alphanumeric\n> characters, `-` and `.` are allowed in section names. Each variable\n> must belong to some section, which means that there must be a section\n> header before the first setting of a variable.\n> \n> [...]\n> \n> Subsection names are case sensitive and can contain any characters except\n> newline and the null byte.\n> \n> The variable names are case-insensitive, allow only alphanumeric characters\n> and `-`, and must start with an alphabetic character.\n> \"\"\"\n\nI don't think it's necessary to quote this whole paragraph here, as most\nof us should be quite familiar with its format. I'd rather summarize the\ninfo a bit and explain how we can use the userdiff patterns for the\ngeneral structure of the config. And in case there are any subtleties in\nthe format it may make sense to specifically point out those instead of\nquoting the whole manual.\n\n> Then, add a new builtin driver for gitconfig files, where:\n> \n> - the funcname regular expression matches sections and subsections,\n>   i. e. the pattern [SECTION] or [SECTION \"SUBSECTION\"], where the\n>   section is composed by alphanumeric numbers, `-` and `.`, and\n>   subsection names may be composed by any characters;\n\nOkay, makes sense.\n\n> - word_regex is more permissive, matching any word with one or more\n>   non-whitespace characters.\n\nIt would be nice to provide context _why_ it is more permissive and what\nthe effect is.\n\nThe order of the commit message in our project is typically a bit\ndifferent than what you have here: we first explain the actual problem\nthat we aim to solve before discussing how you solve it.\n\nThe code change itself looks sensible to me.\n\nPatrick\n"},{"id":"514723","messageId":"Z9vUAzt-5FNgSEKd@pks.im","threadId":"63165","inReplyTo":"20250319172016.2115-3-lucasseikioshiro@gmail.com","subject":"Re: [GSoC PATCH 2/2] t4018: add tests for gitconfig in userdiff","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-03-20T08:38:27Z","receivedAt":"2025-03-20T08:38:35Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Mar 19, 2025 at 02:20:16PM -0300, Lucas Seiki Oshiro wrote:\n> Add userdiff tests for gitconfig files. These files define sections and\n> subsections, with and without indentation.\n\nI think it would make sense to suqash this commit into the first one.\n\n> diff --git a/t/t4018/gitconfig-section b/t/t4018/gitconfig-section\n> new file mode 100644\n> index 0000000000..866aa70b24\n> --- /dev/null\n> +++ b/t/t4018/gitconfig-section\n> @@ -0,0 +1,5 @@\n> +[RIGHT]\n> +        # comment\n> +        ; comment\n> +        name = value\n> +        ChangeMe\n> \\ No newline at end of file\n\nYou're missing newlines at the end of al test files. I don't think this\nis intentional, is it?\n\nPatrick\n"},{"id":"514816","messageId":"CALnO6CACKrP=GZ-zB=4EWMjPv1RcvqgQuE5rzQM+V8C3PU3VZg@mail.gmail.com","threadId":"63165","inReplyTo":"Z9vT-dqBzXxzXnlU@pks.im","subject":"Re: [GSoC PATCH 1/2] userdiff: add builtin driver for gitconfig syntax","fromName":"D. Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2025-03-21T02:11:33Z","receivedAt":"2025-03-21T02:11:48Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"On Thu, Mar 20, 2025 at 4:41 AM Patrick Steinhardt <ps@pks.im> wrote:\n>\n> On Wed, Mar 19, 2025 at 02:20:15PM -0300, Lucas Seiki Oshiro wrote:\n> > From Documentation/config.adoc:\n> >\n> > \"\"\"\n> > The file consists of sections and variables. A section begins with\n> > the name of the section in square brackets and continues until the next\n> > section begins. Section names are case-insensitive. Only alphanumeric\n> > characters, `-` and `.` are allowed in section names. Each variable\n> > must belong to some section, which means that there must be a section\n> > header before the first setting of a variable.\n> >\n> > [...]\n> >\n> > Subsection names are case sensitive and can contain any characters except\n> > newline and the null byte.\n> >\n> > The variable names are case-insensitive, allow only alphanumeric characters\n> > and `-`, and must start with an alphabetic character.\n> > \"\"\"\n>\n> I don't think it's necessary to quote this whole paragraph here, as most\n> of us should be quite familiar with its format. I'd rather summarize the\n> info a bit and explain how we can use the userdiff patterns for the\n> general structure of the config. And in case there are any subtleties in\n> the format it may make sense to specifically point out those instead of\n> quoting the whole manual.\n\nAnd, if we really felt it important to direct readers to the full\ntext, we could instruct them to do something like `git show\n<sensible-hash>:Documentation/config.adoc`—in other words, the text is\na part of this commit (and its parent) even if we don't (fully) quote\nit here.\n\nCheers,\nBen\n"},{"id":"514881","messageId":"204EB04B-40E5-4D10-8C2F-46D6F2E3F77C@gmail.com","threadId":"63165","inReplyTo":"Z9vUAzt-5FNgSEKd@pks.im","subject":"Re: [GSoC PATCH 2/2] t4018: add tests for gitconfig in userdiff","fromName":"Lucas Seiki Oshiro","fromEmail":"lucasseikioshiro@gmail.com","sentAt":"2025-03-23T16:08:04Z","receivedAt":"2025-03-23T16:08:18Z","isPatch":true,"sender":{"key":"lucasseikioshiro@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12701580?v=4"},"body":"\n> I think it would make sense to suqash this commit into the first one.\n\nOk! I'll do that in a v2.\n\n> You're missing newlines at the end of al test files. I don't think this\n> is intentional, is it?\n\nNo... somehow my text editor is not configured to do that. I'll fix it.\n\n\n"}]}