Re: [PATCH 02/11] config-batch: create parse loop and unknown command
- From
Jean-Noël Avila <jn.avila@free.fr>
- Date
- Feb 6, 2026, 04:15 UTC
- Message-ID
- <f6f8c84b-4672-49ac-bda3-0205cdeaff9c@free.fr>
- In-Reply-To
- <ecd26a0f1fad5615aea07a388e34f02e9f33b870.1770214803.git.gitgitgadget@gmail.com>
Le 04/02/2026 à 15:19, Derrick Stolee via GitGitGadget a écrit :
Show 38 quoted lines
> From: Derrick Stolee <stolee@gmail.com> > > As we build new features in the config-batch command, we define the > plaintext protocol with line-by-line output and responses. To think to the > future, we make sure that the protocol has a clear way to respond to an > unknown command or an unknown version of that command. > > As some commands will allow the final argument to contain spaces or even be > able to parse "\ " as a non-split token, we only provide the remaining line > as data. > > Signed-off-by: Derrick Stolee <stolee@gmail.com> > --- > Documentation/git-config-batch.adoc | 23 ++++- > builtin/config-batch.c | 133 +++++++++++++++++++++++++++- > t/t1312-config-batch.sh | 19 +++- > 3 files changed, 170 insertions(+), 5 deletions(-) > > diff --git a/Documentation/git-config-batch.adoc b/Documentation/git-config-batch.adoc > index dfa0bd83e2..9ca04b0c1e 100644 > --- a/Documentation/git-config-batch.adoc > +++ b/Documentation/git-config-batch.adoc > @@ -13,7 +13,28 @@ SYNOPSIS > > DESCRIPTION > ----------- > -TODO > +Tools frequently need to change their behavior based on values stored in > +Git's configuration files. These files may have complicated conditions > +for including extra files, so it is difficult to produce an independent > +parser. To avoid executing multiple processes to discover or modify > +multiple configuration values, the `git config-batch` command allows a > +single process to handle multiple requests using a machine-parseable > +interface across `stdin` and `stdout`. > + > +PROTOCOL > +-------- > +By default, the protocol uses line feeds (`LF`) to signal the end of a
Characters are typefaced as placeholders: _LF_
Show 11 quoted lines
> +command over `stdin` or a response over `stdout`. > + > +The protocol will be extended in the future, and consumers should be > +resilient to older Git versions not understanding the latest command > +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> +``` >
This is Markdown. For Asciidoc, use code block:
---- unknown_command LF ----