git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 00/11] [RFC] config-batch: a new builtin for tools querying config

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 4, 2026, 14:19 UTC
Message-ID
<pull.2033.git.1770214803.gitgitgadget@gmail.com>

This RFC explores a new git config-batch builtin that allows tools to interact with Git's config data with multiple queries using a single process. This is an orthogonal alternative to the effort to create a stable, linkable config API. Both approaches have different strengths.

My main motivation is the performance of git-credential-manager on Windows platforms as it can call git config get dozens of times. At 150-200ms per execution, that adds up significantly, leading to multiple seconds just to load a credential that already exists. I believe that there are other benefits to having this interface available, but I can't recall any specifics at the moment.

This RFC adds git config-batch with a protocol over stdin/stdout for executing multiple config queries. The implementation has a limited set of potential queries, but also creates a model for compatibility for tools to automatically adapt to different Git versions.

I'm submitting this as an RFC before I've polished all of the details because I want to make sure I'm going down a good direction. Please focus feedback in these questions:

 * Is this a worthwhile feature to add to Git?
 * Is this a reasonable protocol for stdin/stdout?
 * How can we structure the code to make it easier to contribute new
   commands in the future?
 * This seems like a place where parallel contributions can be made once the
   baseline is implemented. Is there interest in further contributions to
   expand the commands?
This RFC adds the following commands over stdin:
 1. help lists the available commands, giving the caller an understanding of
    what is available in this Git version.
 2. get loads a value for a given key within a certain scope, with optional
    value patterns.
 3. set assigns a key-value pair in a given scope.
 4. unset removes a key-value pair in a given scope with optional value
    patterns.

Each command has an associated version, in case we need to expand or alter the functionality in the future. This includes the potential to deprecate and remove certain versions that we no longer want to support, such as replacing set version 1 with a version 2 and making version 1 no longer available. I do hope that we will mostly be able to move with new command names, such as a set-all command including the options for git config set --all ... instead of increasing the version of the set command.

There is a -z option that changes the command interface to use NUL-terminated strings. Two NULs specify a command boundary, which promotes compatibility with a caller that sends an unknown command. However, this means that we cannot specify an empty string as a token within a command unless we add more data. This format uses <N>:<string> to provide the integer <N> which specifies the length of <string>. This is a little cumbersome, but the format is intended for tools, not humans.

I have a test integration with git-credential-manager available [1] for testing. This includes a model for interacting with git config-batch in a compatible way that will respond to certain features not being available:

 1. If git config-batch fails immediately, then all queries are handled by
    git config.
 2. If git config-batch starts without failure, then the first query is for
    the help command.
 3. As queries come to the config system, the query is checked against the
    available commands advertised by git config-batch. If the appropriate
    command is available, then the query is made in that process. If not,
    then the query uses the existing git config command.

One thing that I think would be valuable to include is a reload command that signals that the git config-batch process should reload the configset into memory due to config manipulations in other processes, especially while git config-batch doesn't have all capabilities from git config. I'll include that in the first version for review, if this RFC leads to positive support.

[1] https://github.com/git-ecosystem/git-credential-manager/pull/2245

I have a few concerns with this implementation that I'd like to improve before submitting a version for full review. I list them here so you can see the flaws that I already see, but also so you can add to this list:

 * We need a reload command (as mentioned above).
 * The tests need to include a submodule and submodule-level config.
 * When specifying the local scope to the get command, the matched value
   does not include worktree or submodule config in the same way that git
   config get --local <key> would.
 * The token-parsing API in this helper is still too complicated to use. I
   should create parsing tooling similar to the parse-opts API so each
   command could specify its use of positional values and optional
   arguments.
 * The use of arg:<arg> to specify an optional argument creates the
   inability to submit a value that starts with arg:. Consider alternative
   ways to specify arguments or to specify that the remaining data in the
   command (including spaces) is a final positional argument.
 * In general, I found myself implementing behavior based on the deprecated
   forms of git config that use the --get or --unset style arguments instead
   of git config (set|unset|get) subcommands. It's worth making sure that
   any references to equivalent git config commands use the new modes.
 * I need to add an --[no-]includes option as a command-line argument that
   signals whether include sections should be followed. I don't believe this
   should be specified on a per-command basis, but I'm open to suggestions.
 * I have an early draft of a technical document detailing the plan for this
   builtin. It has some lists of intended future commands that have not been
   implemented. This would also be a good place to document any parsing APIs
   built to help contributors adding to this builtin.
Thanks, -Stolee
Derrick Stolee (11):
  config-batch: basic boilerplate of new builtin
  config-batch: create parse loop and unknown command
  config-batch: implement get v1
  config-batch: create 'help' command
  config-batch: add NUL-terminated I/O format
  docs: add design doc for config-batch
  config: extract location structs from builtin
  config-batch: pass prefix through commands
  config-batch: add 'set' v1 command
  t1312: create read/write test
  config-batch: add unset v1 command
 .gitignore                                |   1 +
 Documentation/git-config-batch.adoc       | 214 ++++++
 Documentation/meson.build                 |   1 +
 Documentation/technical/config-batch.adoc |  70 ++
 Makefile                                  |   1 +
 builtin.h                                 |   7 +
 builtin/config-batch.c                    | 772 ++++++++++++++++++++++
 builtin/config.c                          | 117 +---
 command-list.txt                          |   1 +
 config.c                                  | 116 ++++
 config.h                                  |  26 +
 git.c                                     |   1 +
 meson.build                               |   1 +
 t/meson.build                             |   1 +
 t/t1312-config-batch.sh                   | 372 +++++++++++
 15 files changed, 1592 insertions(+), 109 deletions(-)
 create mode 100644 Documentation/git-config-batch.adoc
 create mode 100644 Documentation/technical/config-batch.adoc
 create mode 100644 builtin/config-batch.c
 create mode 100755 t/t1312-config-batch.sh
base-commit: 83a69f19359e6d9bc980563caca38b2b5729808c
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2033%2Fderrickstolee%2Fbatched-config-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2033/derrickstolee/batched-config-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2033
-- 
gitgitgadget
Next: Derrick Stolee via GitGitGadget
Message 1 of 40 in “[RFC] config-batch: a new builtin for tools querying config”
  1. 00/11 [RFC] config-batch: a new builtin for tools querying configDerrick Stolee via GitGitGadget, Feb 4, 2026
  2. 01/11 config-batch: basic boilerplate of new builtinDerrick Stolee via GitGitGadget, Feb 4, 2026
  3. Junio C HamanoFeb 4, 2026
  4. Derrick StoleeFeb 5, 2026
  5. Kristoffer HaugsbakkFeb 5, 2026
  6. Kristoffer HaugsbakkFeb 5, 2026
  7. Jean-Noël AvilaFeb 6, 2026
  8. 02/11 config-batch: create parse loop and unknown commandDerrick Stolee via GitGitGadget, Feb 4, 2026
  9. Junio C HamanoFeb 4, 2026
  10. Kristoffer HaugsbakkFeb 5, 2026
  11. Jean-Noël AvilaFeb 6, 2026
  12. 03/11 config-batch: implement get v1Derrick Stolee via GitGitGadget, Feb 4, 2026
  13. Jean-Noël AvilaFeb 6, 2026
  14. 04/11 config-batch: create 'help' commandDerrick Stolee via GitGitGadget, Feb 4, 2026
  15. Jean-Noël AvilaFeb 6, 2026
  16. Derrick StoleeFeb 10, 2026
  17. 05/11 config-batch: add NUL-terminated I/O formatDerrick Stolee via GitGitGadget, Feb 4, 2026
  18. Kristoffer HaugsbakkFeb 5, 2026
  19. Jean-Noël AvilaFeb 6, 2026
  20. 06/11 docs: add design doc for config-batchDerrick Stolee via GitGitGadget, Feb 4, 2026
  21. Kristoffer HaugsbakkFeb 5, 2026
  22. Derrick StoleeFeb 10, 2026
  23. 07/11 config: extract location structs from builtinDerrick Stolee via GitGitGadget, Feb 4, 2026
  24. 08/11 config-batch: pass prefix through commandsDerrick Stolee via GitGitGadget, Feb 4, 2026
  25. 09/11 config-batch: add 'set' v1 commandDerrick Stolee via GitGitGadget, Feb 4, 2026
  26. Kristoffer HaugsbakkFeb 5, 2026
  27. Kristoffer HaugsbakkFeb 5, 2026
  28. Kristoffer HaugsbakkFeb 5, 2026
  29. Derrick StoleeFeb 10, 2026
  30. Jean-Noël AvilaFeb 6, 2026
  31. 10/11 t1312: create read/write testDerrick Stolee via GitGitGadget, Feb 4, 2026
  32. 11/11 config-batch: add unset v1 commandDerrick Stolee via GitGitGadget, Feb 4, 2026
  33. Kristoffer HaugsbakkFeb 5, 2026
  34. Junio C HamanoFeb 4, 2026
  35. Derrick StoleeFeb 5, 2026
  36. brian m. carlsonFeb 5, 2026
  37. Derrick StoleeFeb 5, 2026
  38. Derrick StoleeFeb 10, 2026
  39. Phillip WoodFeb 5, 2026
  40. Kristoffer HaugsbakkFeb 5, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.