diff options
| author | Ralph Seichter <github@seichter.de> | 2024-03-12 21:47:00 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-03-15 12:25:35 -0700 |
| commit | 42d5c033945e4fc41d7268bfe4284d37651986b8 (patch) | |
| tree | db87697441a5ef5dab70079a6190eaaab148d47c /submodule.c | |
| parent | 4f9b731bdeccffa1b13e5edf4bc0428b8d49704e (diff) | |
| download | git-42d5c033945e4fc41d7268bfe4284d37651986b8.tar.gz | |
config: add --comment option to add a comment
Introduce the ability to append comments to modifications
made using git-config. Example usage:
git config --comment "changed via script" \
--add safe.directory /home/alice/repo.git
based on the proposed patch, the output produced is:
[safe]
directory = /home/alice/repo.git #changed via script
Users need to be able to distinguish between config entries made
using automation and entries made by a human. Automation can add
comments containing a URL pointing to explanations for the change
made, avoiding questions from users as to why their config file
was changed by a third party.
The implementation ensures that a # character is unconditionally
prepended to the provided comment string, and that the comment
text is appended as a suffix to the changed key-value-pair in the
same line of text. Multi-line comments (i.e. comments containing
linefeed) are rejected as errors, causing Git to exit without
making changes.
Comments are aimed at humans who inspect or change their Git
config using a pager or editor. Comments are not meant to be
read or displayed by git-config at a later time.
Signed-off-by: Ralph Seichter <github@seichter.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
| -rw-r--r-- | submodule.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/submodule.c b/submodule.c index f0ddb31e8f..ce2d032521 100644 --- a/submodule.c +++ b/submodule.c @@ -2046,7 +2046,7 @@ void submodule_unset_core_worktree(const struct submodule *sub) submodule_name_to_gitdir(&config_path, the_repository, sub->name); strbuf_addstr(&config_path, "/config"); - if (git_config_set_in_file_gently(config_path.buf, "core.worktree", NULL)) + if (git_config_set_in_file_gently(config_path.buf, "core.worktree", NULL, NULL)) warning(_("Could not unset core.worktree setting in submodule '%s'"), sub->path); |
