Skip to content

Conversation

@derrickstolee
Copy link

@derrickstolee derrickstolee commented Jan 17, 2026

TBD.

I have a test integration with git-credential-manager available [1] for testing.

[1] git-ecosystem/git-credential-manager#2245

Thanks,
-Stolee

cc: gitster@pobox.com

@derrickstolee derrickstolee force-pushed the batched-config branch 5 times, most recently from f4ae10d to 931fbf4 Compare January 18, 2026 03:40
@derrickstolee derrickstolee changed the title git-config-batch: a new builtin for tools reading config [RFC] git-config-batch: a new builtin for tools reading config Jan 18, 2026
return 0;

if (d->scope != CONFIG_SCOPE_UNKNOWN &&
d->scope != context->kvi->scope)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to self: --local will get things from worktree config, right? We should check to see if a function is needed here. --system and --global care about only one layer, but --local is more complicated, I think.

@derrickstolee derrickstolee force-pushed the batched-config branch 3 times, most recently from 0829d86 to 7c669bc Compare January 22, 2026 03:00
Later changes will document, implement, and test this new builtin. For now,
this serves as the latest example of the minimum boilerplate to introduce a
new builtin.

Recently, we updated the comment in builtin.h about how to create a new
builtin, but failed to mention the required change to meson.build files for
some CI builds to pass. Fix that oversight.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
@derrickstolee derrickstolee force-pushed the batched-config branch 2 times, most recently from ff663df to 8190c26 Compare January 22, 2026 12:48
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>
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 <key>' 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 <stolee@gmail.com>
Tools that use the 'git config-batch' tool will want to know which commands
are available in the current Git version. Having a 'help' command assists
greatly to give a clear set of available commands and their versions.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
When using automated tools, it is critical to allow for input/output formats
that include special characters such as spaces and newlines. While the
existing protocol for 'git config-batch' is human-readable and has some
capacity for some spaces in certain positions, it is not available for
spaces in the config key or newlines in the config values.

Add the '-z' option to signal the use of NUL-terminated strings. To
understand where commands end regardless of potential future formats, use
two NUL bytes in a row to terminate a command. To allow for empty string
values, each token is provided in a <length>:<value> format, making "0:"
the empty string value.

Update the existing 'help' and 'get' commands to match this format. Create
helper methods that make it easy to parse and print in both formats
simultaneously.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant