From: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Patrick Steinhardt <ps@pks.im>,
"D . Ben Knoble" <ben.knoble@gmail.com>,
git@vger.kernel.org
Subject: Re: [GSoC PATCH v2] userdiff: add builtin driver for gitconfig syntax
Date: Tue, 25 Mar 2025 15:34:57 -0300 [thread overview]
Message-ID: <FE085EEC-0BCC-43D9-9F17-1A7060DC4D6E@gmail.com> (raw)
In-Reply-To: <d4c0c9a4-0402-4456-9fa0-3102b5bcc3dc@kdbg.org>
> Can we please have a more recent reference? The difference of config.txt
> here and config.adoc above is very surprising.
Hmmmm... My idea was to reference the last change in the paragraphs
of the documentation, but I'll change to the last change of this file.
> The file format of .git/config files isn't specific to .git/config; it's
> called "ini-file" and is already very old. Wouldn't it make sense to
> generalize the format? It would be just a matter of choosing a different
> name; the regular expressions would not have to change.
Indeed. This is was written having the gitconfig in mind, but perhaps I
could use a different approach and make a little more flexible for other
INI flavors and perhaps even TOML
> This could test two sub-sections in a row and ensure that the later one
> is chosen.
Nice! I'll do that.
> What happens if there is an *indented* header after the "RIGHT" one?
> Should it be chosen or not? Can this happen in a valid file?
I just tested here, it is valid file. I'll take indentation into acoount
in v3.
> The regular expression can assume that the syntax of the processed file
> is correct. For example,
>
> [!not a section!]
> cannot be a section header and will not occur in a valid file. Or can it?
Following the gitconfig syntax specification it can't be in a valid file,
and this regex won't match it.
> Therefore, it would be sufficient to just take everything after the '['
> at the beginning of the line without further inspection.
I can't see any harm in just dropping the section name matching and using
a generic /\[.+\]/. It may be also useful for more generic INI files that
you mentioned before.
> Furthermore, a valid file can look like this:
>
> [section] key = value
> another_key = more values
To be honest, I didn't know that it could was a valid file. I'll include
that in a v3.
Thanks for your extensive review!
next prev parent reply other threads:[~2025-03-25 18:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 2:11 [GSoC PATCH v2] userdiff: add builtin driver for gitconfig syntax Lucas Seiki Oshiro
2025-03-24 7:18 ` Johannes Sixt
2025-03-24 20:23 ` D. Ben Knoble
2025-03-25 18:34 ` Lucas Seiki Oshiro [this message]
2025-03-24 9:43 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=FE085EEC-0BCC-43D9-9F17-1A7060DC4D6E@gmail.com \
--to=lucasseikioshiro@gmail.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).