forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 166
[RFC] git-config-batch: a new builtin for tools reading config #2033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
derrickstolee
wants to merge
4
commits into
gitgitgadget:master
Choose a base branch
from
derrickstolee:batched-config
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78e771b to
59333ec
Compare
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 for some CI builds to pass. Fix that oversight. Signed-off-by: Derrick Stolee <stolee@gmail.com>
f4ae10d to
931fbf4
Compare
derrickstolee
commented
Jan 18, 2026
| return 0; | ||
|
|
||
| if (d->scope != CONFIG_SCOPE_UNKNOWN && | ||
| d->scope != context->kvi->scope) |
Author
There was a problem hiding this comment.
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.
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. 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>
931fbf4 to
ad1058b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TBD.
I have a test integration with
git-credential-manageravailable [1] for testing.[1] git-ecosystem/git-credential-manager#2245
Thanks,
-Stolee
cc: gitster@pobox.com