From: Jean-Noël Avila Date: Fri, 06 Feb 2026 04:41:49 GMT Subject: Re: [PATCH 03/11] config-batch: implement get v1 Message-ID: <61926b22-dca1-4e5d-a911-6fc47dee68d6@free.fr> In-Reply-To: <3de1bba3b10668f0200e27def9128571f51c1f68.1770214803.git.gitgitgadget@gmail.com> Le 04/02/2026 à 15:19, Derrick Stolee via GitGitGadget a écrit : > From: Derrick Stolee > > The 'get' command for the 'git config-batch' builtin is the first command > and is currently at version 1. It returns at most one value, the same as > 'git config --get ' with optional value-based filtering. > > The documentation and tests detail the specifics of how to format requests > of this format and how to parse the results. > > Future versions could consider multi-valued responses or regex-based key > matching. > > For the sake of incremental exploration of the potential in the 'git > config-batch' command, this is the only implementation being presented in > the first patch series. > > Future extensions could include a '-z' parameter that uses NUL bytes in the > command and output format to allow for spaces or newlines in the input or > newlines in the output. > > Signed-off-by: Derrick Stolee > --- > Documentation/git-config-batch.adoc | 53 +++++- > builtin/config-batch.c | 251 +++++++++++++++++++++++++++- > config.h | 3 + > t/t1312-config-batch.sh | 101 +++++++++++ > 4 files changed, 405 insertions(+), 3 deletions(-) > > diff --git a/Documentation/git-config-batch.adoc b/Documentation/git-config-batch.adoc > index 9ca04b0c1e..31dd42f481 100644 > --- a/Documentation/git-config-batch.adoc > +++ b/Documentation/git-config-batch.adoc > @@ -32,9 +32,58 @@ set. Thus, if the Git version includes the `git config-batch` builtin > but doesn't understand an input command, it will return a single line > response: > > -``` > +------------ > unknown_command LF > -``` > +------------ > + OK, the change to Asciidoc code block is done here. Would it be possible to push it up at the introduction of these lines? > +These are the commands that are currently understood: > + > +`get` version 1:: > + The `get` command searches the config key-value pairs within a > + given `` for values that match the fixed `` and The rendering of these is correct due to the synopsis formatter, but we usually prefer to use the direct formatting for placeholders: __, __,… > + filters the resulting value based on an optional ``. > + This can either be a regex or a fixed value. The command format > + is one of the following formats: > ++ > +------------ > +get 1 > +get 1 arg:regex > +get 1 arg:fixed-value > +------------ > ++ If you are using synopsis style in the block, with the upcoming change of synopsis style block[1], you can format it: [synopsis] ------------ get 1 get 1 arg:regex get 1 arg:fixed-value ------------ > +The `` value can be one of `inherited`, `system`, `global`, > +`local`, `worktree`, `submodule`, or `command`. If `inherited`, then all > +config key-value pairs will be considered regardless of scope. Otherwise, > +only the given scope will be considered. > ++ > +If no optional arguments are given, then the value will not be filtered > +by any pattern matching. If `arg:regex` is specified, then the rest of > +the line is considered a single string, ``, and is > +interpreted as a regular expression for matching against stored values, > +similar to specifying a value to `get config --get ""`. > +If `arg:fixed-value` is specified, then the rest of the line is > +considered a single string, ``, and is checked for an exact > +match against the key-value pairs, simmilar to `git config --get similar > +--fixed-value ""`. > ++ Here I would use a sub definition list for each matching type, instead of long running description paragraph. optional arguments can be specified: no optional arguments;; the value will not be filteredby any pattern matching. `arg:regex `;; `` is interpreted as a regular expression for matching against stored values, similar to specifying a value to `get config --get ""`. `arg:fixed-value `;; `` is checked for an exact match against the key-value pairs, similar to `git config --get `. > +At mmost one key-value pair is returned, that being the last key-value At most > +pair in the standard config order by scope and sequence within each scope. > ++ > +If a key-value pair is found, then the following output is given: > ++ > +------------ > +get 1 found > +------------ > ++ > +If no matching key-value pair is found, then the following output is > +given: > ++ > +------------ > +get 1 missing [|] > +------------ > ++ Please also apply synopsis block style. > +where `` or `` is only supplied if provided in > +the command. > > SEE ALSO > -------- [1]: https://lore.kernel.org/git/6a2b94e720862fa07fe9463ebf7f7beaa9a1ccd4.1770351146.git.gitgitgadget@gmail.com/T/#u