* [PATCH 00/21] config: remove use of `the_repository`
@ 2025-07-17 10:49 Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 01/21] config: drop `git_config()` wrapper Patrick Steinhardt
` (21 more replies)
0 siblings, 22 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
Hi,
this patch series removes uses of `the_repository` in "config.c". It
does this via two things:
- By removing all the wrapper functions `git_config_get()` et al that
implicitly rely on `the_repository`.
- By moving the Git-specific config parsing (that is, the non-business
logic like parsing "core.sharedRepository") into "environment.c".
This series is inspired by my painful tries yesterday to start parsing
repo settings early in the Git process lifecycle. The changes should
make it easier to eventually achieve that.
The patch series is long, but almost all of the patches are trivial as
they simply replace code like `git_config_foo(...)` with its equivalent
`repo_config_foo(the_repository, ...)`.
The series is based on top of 90c0775e972 (The eleventh batch,
2025-07-16) with bc/use-sha256-by-default-in-3.0 at c79bb70a2e7 (Enable
SHA-256 by default in breaking changes mode, 2025-07-01) merged into it
to fix a conflict with "next". There are a couple of merge conflicts
with "seen", but they are trivial to solve.
Thanks!
Patrick
---
Patrick Steinhardt (21):
config: drop `git_config()` wrapper
config: drop `git_config_clear()` wrapper
config: drop `git_config_get()` wrapper
config: drop `git_config_get_value()` wrapper
config: drop `git_config_get_value()` wrapper
config: drop `git_config_get_string_multi()` wrapper
config: drop `git_config_get_string()` wrapper
config: drop `git_config_get_string()` wrapper
config: drop `git_config_get_int()` wrapper
config: drop `git_config_get_ulong()` wrapper
config: drop `git_config_get_bool()` wrapper
config: drop `git_config_set_in_file()` wrapper
config: drop `git_config_set_gently()` wrapper
config: drop `git_config_set()` wrapper
config: drop `git_config_set_in_file_gently()` wrapper
config: drop `git_config_set_multivar_in_file_gently()` wrapper
config: drop `git_config_get_multivar_gently()` wrapper
config: drop `git_config_set_multivar()` wrapper
config: remove unused `the_repository` wrappers
config: move Git config parsing into "environment.c"
config: fix sign comparison warnings
Documentation/user-manual.adoc | 2 +-
apply.c | 6 +-
archive-tar.c | 2 +-
archive-zip.c | 2 +-
archive.c | 4 +-
branch.c | 10 +-
builtin/add.c | 1 +
builtin/am.c | 10 +-
builtin/blame.c | 2 +-
builtin/branch.c | 8 +-
builtin/cat-file.c | 2 +-
builtin/check-attr.c | 2 +-
builtin/check-ignore.c | 3 +-
builtin/check-mailmap.c | 3 +-
builtin/checkout--worker.c | 3 +-
builtin/checkout-index.c | 1 +
builtin/checkout.c | 4 +-
builtin/clean.c | 3 +-
builtin/clone.c | 26 +-
builtin/column.c | 4 +-
builtin/commit-graph.c | 5 +-
builtin/commit-tree.c | 3 +-
builtin/commit.c | 4 +-
builtin/config.c | 60 +--
builtin/count-objects.c | 3 +-
builtin/credential-cache--daemon.c | 2 +-
builtin/credential-store.c | 2 +-
builtin/credential.c | 3 +-
builtin/describe.c | 2 +-
builtin/diff-files.c | 2 +-
builtin/diff-index.c | 2 +-
builtin/diff-tree.c | 2 +-
builtin/diff.c | 2 +-
builtin/fast-export.c | 3 +-
builtin/fast-import.c | 12 +-
builtin/fetch.c | 10 +-
builtin/fmt-merge-msg.c | 2 +-
builtin/for-each-ref.c | 1 +
builtin/fsck.c | 2 +-
builtin/fsmonitor--daemon.c | 3 +-
builtin/gc.c | 70 ++--
builtin/grep.c | 5 +-
builtin/hash-object.c | 3 +-
builtin/help.c | 5 +-
builtin/hook.c | 3 +-
builtin/index-pack.c | 2 +-
builtin/interpret-trailers.c | 3 +-
builtin/log.c | 24 +-
builtin/ls-files.c | 1 +
builtin/ls-tree.c | 3 +-
builtin/merge-base.c | 3 +-
builtin/merge-file.c | 2 +-
builtin/merge-tree.c | 3 +-
builtin/merge.c | 2 +-
builtin/mktag.c | 2 +-
builtin/multi-pack-index.c | 5 +-
builtin/mv.c | 2 +-
builtin/name-rev.c | 2 +-
builtin/notes.c | 4 +-
builtin/pack-objects.c | 2 +-
builtin/pack-refs.c | 1 +
builtin/patch-id.c | 3 +-
builtin/pull.c | 9 +-
builtin/push.c | 2 +-
builtin/range-diff.c | 2 +-
builtin/read-tree.c | 3 +-
builtin/rebase.c | 4 +-
builtin/receive-pack.c | 2 +-
builtin/reflog.c | 2 +-
builtin/refs.c | 2 +-
builtin/remote.c | 56 +--
builtin/repack.c | 2 +-
builtin/replace.c | 3 +-
builtin/rerere.c | 2 +-
builtin/reset.c | 2 +-
builtin/rev-list.c | 2 +-
builtin/rev-parse.c | 4 +-
builtin/rm.c | 3 +-
builtin/send-pack.c | 1 +
builtin/shortlog.c | 2 +-
builtin/show-branch.c | 2 +-
builtin/show-ref.c | 3 +-
builtin/sparse-checkout.c | 2 +-
builtin/stash.c | 4 +-
builtin/stripspace.c | 2 +-
builtin/submodule--helper.c | 56 +--
builtin/symbolic-ref.c | 3 +-
builtin/tag.c | 2 +-
builtin/unpack-file.c | 3 +-
builtin/unpack-objects.c | 2 +-
builtin/update-index.c | 2 +-
builtin/update-ref.c | 3 +-
builtin/update-server-info.c | 1 +
builtin/var.c | 5 +-
builtin/verify-commit.c | 1 +
builtin/verify-pack.c | 3 +-
builtin/verify-tag.c | 1 +
builtin/worktree.c | 8 +-
builtin/write-tree.c | 3 +-
checkout.c | 2 +-
commit-graph.c | 1 +
compat/precompose_utf8.c | 6 +-
config.c | 546 +------------------------
config.h | 139 -------
connect.c | 6 +-
contrib/coccinelle/config_fn_ctx.pending.cocci | 2 +-
convert.c | 2 +-
daemon.c | 2 +-
dir.c | 4 +-
editor.c | 2 +-
environment.c | 512 +++++++++++++++++++++++
environment.h | 3 +
fetch-pack.c | 16 +-
fsck.c | 1 +
fsck.h | 2 +-
fsmonitor.c | 2 +-
gpg-interface.c | 2 +-
help.c | 6 +-
http-backend.c | 6 +-
http-fetch.c | 3 +-
http.c | 3 +-
imap-send.c | 3 +-
list-objects-filter-options.c | 6 +-
ls-refs.c | 2 +-
mailinfo.c | 1 +
merge-ll.c | 2 +-
merge-ort.c | 18 +-
notes-utils.c | 2 +-
notes.c | 2 +-
parallel-checkout.c | 4 +-
pretty.c | 2 +-
promisor-remote.c | 8 +-
protocol.c | 2 +-
reachable.c | 2 +-
read-cache.c | 4 +-
rebase-interactive.c | 2 +-
reflog.c | 1 +
refs.c | 2 +-
refs/packed-backend.c | 2 +-
refs/reftable-backend.c | 2 +-
remote.c | 2 +-
rerere.c | 9 +-
revision.c | 2 +-
run-command.c | 6 +-
scalar.c | 18 +-
sequencer.c | 36 +-
setup.c | 44 +-
sideband.c | 6 +-
submodule-config.c | 2 +-
submodule.c | 2 +-
t/helper/test-advise.c | 3 +-
t/helper/test-config.c | 20 +-
t/helper/test-read-cache.c | 3 +-
t/helper/test-userdiff.c | 2 +-
t/t4256/1/mailinfo.c | 2 +-
t/t4256/1/mailinfo.c.orig | 2 +-
trailer.c | 4 +-
transport.c | 12 +-
versioncmp.c | 4 +-
worktree.c | 8 +-
xdiff-interface.c | 1 +
161 files changed, 1009 insertions(+), 1096 deletions(-)
---
base-commit: 592f97530d99d182d69c66e08279e189d006b410
change-id: 20250716-pks-config-wo-the-repository-21de9489f965
^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH 01/21] config: drop `git_config()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 02/21] config: drop `git_config_clear()` wrapper Patrick Steinhardt
` (20 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config()`. All callsites
are adjusted so that they use `repo_config(the_repository, ...)`
instead. While some callsites might already have a repository available,
this mechanical conversion is the exact same as the current situation
and thus cannot cause any regression. Those sites should eventually be
cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/user-manual.adoc | 2 +-
apply.c | 2 +-
archive-tar.c | 2 +-
archive-zip.c | 2 +-
archive.c | 2 +-
builtin/am.c | 2 +-
builtin/blame.c | 2 +-
builtin/branch.c | 2 +-
builtin/cat-file.c | 2 +-
builtin/check-attr.c | 2 +-
builtin/check-ignore.c | 2 +-
builtin/check-mailmap.c | 2 +-
builtin/checkout--worker.c | 2 +-
builtin/checkout.c | 2 +-
builtin/clean.c | 2 +-
builtin/clone.c | 4 ++--
builtin/column.c | 4 ++--
builtin/commit-graph.c | 4 ++--
builtin/commit-tree.c | 2 +-
builtin/commit.c | 4 ++--
builtin/config.c | 2 +-
builtin/count-objects.c | 2 +-
builtin/credential.c | 2 +-
builtin/describe.c | 2 +-
builtin/diff-files.c | 2 +-
builtin/diff-index.c | 2 +-
builtin/diff-tree.c | 2 +-
builtin/diff.c | 2 +-
builtin/fast-export.c | 2 +-
builtin/fast-import.c | 2 +-
builtin/fetch.c | 4 ++--
builtin/fmt-merge-msg.c | 2 +-
builtin/fsck.c | 2 +-
builtin/fsmonitor--daemon.c | 2 +-
builtin/gc.c | 2 +-
builtin/grep.c | 2 +-
builtin/hash-object.c | 2 +-
builtin/help.c | 4 ++--
builtin/hook.c | 2 +-
builtin/index-pack.c | 2 +-
builtin/interpret-trailers.c | 2 +-
builtin/log.c | 20 ++++++++++----------
builtin/ls-tree.c | 2 +-
builtin/merge-base.c | 2 +-
builtin/merge-file.c | 2 +-
builtin/merge-tree.c | 2 +-
builtin/merge.c | 2 +-
builtin/mktag.c | 2 +-
builtin/multi-pack-index.c | 4 ++--
builtin/mv.c | 2 +-
builtin/name-rev.c | 2 +-
builtin/notes.c | 2 +-
builtin/pack-objects.c | 2 +-
builtin/patch-id.c | 2 +-
builtin/pull.c | 2 +-
builtin/push.c | 2 +-
builtin/range-diff.c | 2 +-
builtin/read-tree.c | 2 +-
builtin/rebase.c | 2 +-
builtin/receive-pack.c | 2 +-
builtin/reflog.c | 2 +-
builtin/refs.c | 2 +-
builtin/remote.c | 6 +++---
builtin/repack.c | 2 +-
builtin/replace.c | 2 +-
builtin/rerere.c | 2 +-
builtin/reset.c | 2 +-
builtin/rev-list.c | 2 +-
builtin/rev-parse.c | 4 ++--
builtin/rm.c | 2 +-
builtin/shortlog.c | 2 +-
builtin/show-branch.c | 2 +-
builtin/show-ref.c | 2 +-
builtin/sparse-checkout.c | 2 +-
builtin/stash.c | 4 ++--
builtin/stripspace.c | 2 +-
builtin/submodule--helper.c | 8 ++++----
builtin/symbolic-ref.c | 2 +-
builtin/tag.c | 2 +-
builtin/unpack-file.c | 2 +-
builtin/unpack-objects.c | 2 +-
builtin/update-index.c | 2 +-
builtin/update-ref.c | 2 +-
builtin/var.c | 4 ++--
builtin/verify-pack.c | 2 +-
builtin/worktree.c | 2 +-
builtin/write-tree.c | 2 +-
config.h | 5 -----
connect.c | 2 +-
contrib/coccinelle/config_fn_ctx.pending.cocci | 2 +-
convert.c | 2 +-
fetch-pack.c | 2 +-
fsck.h | 2 +-
gpg-interface.c | 2 +-
help.c | 4 ++--
http-fetch.c | 2 +-
http.c | 2 +-
imap-send.c | 2 +-
ls-refs.c | 2 +-
merge-ll.c | 2 +-
merge-ort.c | 2 +-
notes-utils.c | 2 +-
notes.c | 2 +-
pretty.c | 2 +-
refs/reftable-backend.c | 2 +-
rerere.c | 4 ++--
revision.c | 2 +-
scalar.c | 2 +-
sequencer.c | 2 +-
setup.c | 4 ++--
t/helper/test-advise.c | 2 +-
t/helper/test-config.c | 8 ++++----
t/helper/test-read-cache.c | 2 +-
t/helper/test-userdiff.c | 2 +-
t/t4256/1/mailinfo.c | 2 +-
t/t4256/1/mailinfo.c.orig | 2 +-
trailer.c | 4 ++--
transport.c | 2 +-
118 files changed, 148 insertions(+), 153 deletions(-)
diff --git a/Documentation/user-manual.adoc b/Documentation/user-manual.adoc
index 8d00a9e8229..76969871176 100644
--- a/Documentation/user-manual.adoc
+++ b/Documentation/user-manual.adoc
@@ -4270,7 +4270,7 @@ So, look into `builtin/cat-file.c`, search for `cmd_cat_file()` and look what
it does.
------------------------------------------------------------------
- git_config(git_default_config);
+ repo_config(the_repository, git_default_config);
if (argc != 3)
usage("git cat-file [-t|-s|-e|-p|<type>] <sha1>");
if (get_sha1(argv[2], sha1))
diff --git a/apply.c b/apply.c
index a3804316fbd..d2381a157c0 100644
--- a/apply.c
+++ b/apply.c
@@ -50,7 +50,7 @@ static void git_apply_config(void)
{
git_config_get_string("apply.whitespace", &apply_default_whitespace);
git_config_get_string("apply.ignorewhitespace", &apply_default_ignorewhitespace);
- git_config(git_xmerge_config, NULL);
+ repo_config(the_repository, git_xmerge_config, NULL);
}
static int parse_whitespace_option(struct apply_state *state, const char *option)
diff --git a/archive-tar.c b/archive-tar.c
index 249164ea77d..73b63ddc41b 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -537,7 +537,7 @@ void init_tar_archiver(void)
tar_filter_config("tar.tgz.remote", "true", NULL);
tar_filter_config("tar.tar.gz.command", internal_gzip_command, NULL);
tar_filter_config("tar.tar.gz.remote", "true", NULL);
- git_config(git_tar_config, NULL);
+ repo_config(the_repository, git_tar_config, NULL);
for (i = 0; i < nr_tar_filters; i++) {
/* omit any filters that never had a command configured */
if (tar_filters[i]->filter_command)
diff --git a/archive-zip.c b/archive-zip.c
index df8866d5bae..dbd90d9c3d4 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -632,7 +632,7 @@ static int write_zip_archive(const struct archiver *ar UNUSED,
{
int err;
- git_config(archive_zip_config, NULL);
+ repo_config(the_repository, archive_zip_config, NULL);
dos_time(&args->time, &zip_date, &zip_time);
diff --git a/archive.c b/archive.c
index f5a9d45c8d3..2dd306a07a7 100644
--- a/archive.c
+++ b/archive.c
@@ -761,7 +761,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
int rc;
git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
describe_status.max_invocations = 1;
ctx.date_mode.type = DATE_NORMAL;
diff --git a/builtin/am.c b/builtin/am.c
index c9d925f7b96..a7e7cf1465a 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -2445,7 +2445,7 @@ int cmd_am(int argc,
show_usage_with_options_if_asked(argc, argv, usage, options);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
am_state_init(&state);
diff --git a/builtin/blame.c b/builtin/blame.c
index 91586e6852b..71efeb7c7e6 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -947,7 +947,7 @@ int cmd_blame(int argc,
const char *const *opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage;
setup_default_color_by_age();
- git_config(git_blame_config, &output_option);
+ repo_config(the_repository, git_blame_config, &output_option);
repo_init_revisions(the_repository, &revs, NULL);
revs.date_mode = blame_date_mode;
revs.diffopt.flags.allow_textconv = 1;
diff --git a/builtin/branch.c b/builtin/branch.c
index c150131bd9f..08e50bf77b3 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -791,7 +791,7 @@ int cmd_branch(int argc,
* Try to set sort keys from config. If config does not set any,
* fall back on default (refname) sorting.
*/
- git_config(git_branch_config, &sorting_options);
+ repo_config(the_repository, git_branch_config, &sorting_options);
if (!sorting_options.nr)
string_list_append(&sorting_options, "refname");
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 2492a0b6f39..b9eb2bb3b92 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -1095,7 +1095,7 @@ int cmd_cat_file(int argc,
OPT_END()
};
- git_config(git_cat_file_config, NULL);
+ repo_config(the_repository, git_cat_file_config, NULL);
batch.buffer_output = -1;
diff --git a/builtin/check-attr.c b/builtin/check-attr.c
index 7cf275b8937..51ed48ce437 100644
--- a/builtin/check-attr.c
+++ b/builtin/check-attr.c
@@ -119,7 +119,7 @@ int cmd_check_attr(int argc,
if (!is_bare_repository())
setup_work_tree();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, check_attr_options,
check_attr_usage, PARSE_OPT_KEEP_DASHDASH);
diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c
index 7b7831d13a8..03033499cb0 100644
--- a/builtin/check-ignore.c
+++ b/builtin/check-ignore.c
@@ -159,7 +159,7 @@ int cmd_check_ignore(int argc,
int num_ignored;
struct dir_struct dir = DIR_INIT;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, check_ignore_options,
check_ignore_usage, 0);
diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c
index be2cebe1215..634626c6728 100644
--- a/builtin/check-mailmap.c
+++ b/builtin/check-mailmap.c
@@ -56,7 +56,7 @@ int cmd_check_mailmap(int argc,
int i;
struct string_list mailmap = STRING_LIST_INIT_NODUP;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, check_mailmap_options,
check_mailmap_usage, 0);
if (argc == 0 && !use_stdin)
diff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c
index da9345a44b8..27a7d4f0409 100644
--- a/builtin/checkout--worker.c
+++ b/builtin/checkout--worker.c
@@ -132,7 +132,7 @@ int cmd_checkout__worker(int argc,
checkout_worker_usage,
checkout_worker_options);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, checkout_worker_options,
checkout_worker_usage, 0);
if (argc > 0)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 0a90b86a729..948ff7bdda7 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1764,7 +1764,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
opts->prefix = prefix;
opts->show_progress = -1;
- git_config(git_checkout_config, opts);
+ repo_config(the_repository, git_checkout_config, opts);
if (the_repository->gitdir) {
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/clean.c b/builtin/clean.c
index 053c94fc6bd..5ee147c4acc 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -949,7 +949,7 @@ int cmd_clean(int argc,
OPT_END()
};
- git_config(git_clean_config, NULL);
+ repo_config(the_repository, git_clean_config, NULL);
argc = parse_options(argc, argv, prefix, options, builtin_clean_usage,
0);
diff --git a/builtin/clone.c b/builtin/clone.c
index 6d08abed37c..3c6d8529b6c 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -1001,7 +1001,7 @@ int cmd_clone(int argc,
packet_trace_identity("clone");
- git_config(git_clone_config, NULL);
+ repo_config(the_repository, git_clone_config, NULL);
argc = parse_options(argc, argv, prefix, builtin_clone_options,
builtin_clone_usage, 0);
@@ -1242,7 +1242,7 @@ int cmd_clone(int argc,
* re-read config after init_db and write_config to pick up any config
* injected by --template and --config, respectively.
*/
- git_config(git_clone_config, NULL);
+ repo_config(the_repository, git_clone_config, NULL);
/*
* If option_reject_shallow is specified from CLI option,
diff --git a/builtin/column.c b/builtin/column.c
index ce6443d5fac..87dce3c6e53 100644
--- a/builtin/column.c
+++ b/builtin/column.c
@@ -42,9 +42,9 @@ int cmd_column(int argc,
/* This one is special and must be the first one */
if (argc > 1 && starts_with(argv[1], "--command=")) {
command = argv[1] + 10;
- git_config(column_config, (void *)command);
+ repo_config(the_repository, column_config, (void *)command);
} else
- git_config(column_config, NULL);
+ repo_config(the_repository, column_config, NULL);
memset(&copts, 0, sizeof(copts));
copts.padding = 1;
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index 25018a0b9df..c5cc601844c 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -265,7 +265,7 @@ static int graph_write(int argc, const char **argv, const char *prefix,
trace2_cmd_mode("write");
- git_config(git_commit_graph_write_config, &opts);
+ repo_config(the_repository, git_commit_graph_write_config, &opts);
argc = parse_options(argc, argv, prefix,
options,
@@ -347,7 +347,7 @@ int cmd_commit_graph(int argc,
};
struct option *options = parse_options_concat(builtin_commit_graph_options, common_opts);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
disable_replace_refs();
save_commit_buffer = 0;
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index 31cfd9bd15d..2f1df28d413 100644
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
@@ -125,7 +125,7 @@ int cmd_commit_tree(int argc,
};
int ret;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
show_usage_with_options_if_asked(argc, argv,
commit_tree_usage, options);
diff --git a/builtin/commit.c b/builtin/commit.c
index fba0dded64a..fcd829e04ec 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -207,9 +207,9 @@ static void status_init_config(struct wt_status *s, config_fn_t fn)
{
wt_status_prepare(the_repository, s);
init_diff_ui_defaults();
- git_config(fn, s);
+ repo_config(the_repository, fn, s);
determine_whence(s);
- s->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after git_config() */
+ s->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after repo_config() */
}
static void rollback_index_files(void)
diff --git a/builtin/config.c b/builtin/config.c
index 5efe2730106..af5d79eadc0 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -1091,7 +1091,7 @@ static int show_editor(struct config_location_options *opts)
die(_("editing stdin is not supported"));
if (opts->source.blob)
die(_("editing blobs is not supported"));
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
config_file = opts->source.file ?
xstrdup(opts->source.file) :
repo_git_path(the_repository, "config");
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index f687647931e..433daff805a 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -106,7 +106,7 @@ int cmd_count_objects(int argc,
OPT_END(),
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, opts, count_objects_usage, 0);
/* we do not take arguments other than flags for now */
diff --git a/builtin/credential.c b/builtin/credential.c
index 2e11b15dde3..52f172e80cb 100644
--- a/builtin/credential.c
+++ b/builtin/credential.c
@@ -16,7 +16,7 @@ int cmd_credential(int argc,
const char *op;
struct credential c = CREDENTIAL_INIT;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
show_usage_if_asked(argc, argv, usage_msg);
if (argc != 2)
diff --git a/builtin/describe.c b/builtin/describe.c
index fbf305d7624..d7dd8139dec 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -623,7 +623,7 @@ int cmd_describe(int argc,
OPT_END(),
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, describe_usage, 0);
if (abbrev < 0)
abbrev = DEFAULT_ABBREV;
diff --git a/builtin/diff-files.c b/builtin/diff-files.c
index 99b1749723b..ea91347ce23 100644
--- a/builtin/diff-files.c
+++ b/builtin/diff-files.c
@@ -31,7 +31,7 @@ int cmd_diff_files(int argc,
show_usage_if_asked(argc, argv, diff_files_usage);
- git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
+ repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/diff-index.c b/builtin/diff-index.c
index 81c0bc8ed7c..522dacfc4cf 100644
--- a/builtin/diff-index.c
+++ b/builtin/diff-index.c
@@ -28,7 +28,7 @@ int cmd_diff_index(int argc,
show_usage_if_asked(argc, argv, diff_cache_usage);
- git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
+ repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index e31cc797fe1..49dd4d00ebf 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -124,7 +124,7 @@ int cmd_diff_tree(int argc,
show_usage_if_asked(argc, argv, diff_tree_usage);
- git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
+ repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/diff.c b/builtin/diff.c
index eebffe36ccf..9a89e25a982 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -486,7 +486,7 @@ int cmd_diff(int argc,
repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);
init_diff_ui_defaults();
- git_config(git_diff_ui_config, NULL);
+ repo_config(the_repository, git_diff_ui_config, NULL);
prefix = precompose_argv_prefix(argc, argv, prefix);
repo_init_revisions(the_repository, &rev, prefix);
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 6a3a17a8cd9..17027b859e0 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -1327,7 +1327,7 @@ int cmd_fast_export(int argc,
usage_with_options (fast_export_usage, options);
/* we handle encodings */
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
repo_init_revisions(the_repository, &revs, prefix);
init_revision_sources(&revision_sources);
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index b1389c59211..607441e921b 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -3541,7 +3541,7 @@ static void git_pack_config(void)
else if (!git_config_get_int("transfer.unpacklimit", &limit))
unpack_limit = limit;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
}
static const char fast_import_usage[] =
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 87a0cca7994..ea447c453d1 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1995,7 +1995,7 @@ static int add_remote_or_group(const char *name, struct string_list *list)
struct remote_group_data g;
g.name = name; g.list = list;
- git_config(get_remote_group, &g);
+ repo_config(the_repository, get_remote_group, &g);
if (list->nr == prev_nr) {
struct remote *remote = remote_get(name);
if (!remote_is_configured(remote, 0))
@@ -2417,7 +2417,7 @@ int cmd_fetch(int argc,
free(anon);
}
- git_config(git_fetch_config, &config);
+ repo_config(the_repository, git_fetch_config, &config);
if (the_repository->gitdir) {
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 3b6aac2cf7f..edb93c0b3a3 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -53,7 +53,7 @@ int cmd_fmt_merge_msg(int argc,
int ret;
struct fmt_merge_msg_opts opts;
- git_config(fmt_merge_msg_config, NULL);
+ repo_config(the_repository, fmt_merge_msg_config, NULL);
argc = parse_options(argc, argv, prefix, options, fmt_merge_msg_usage,
0);
if (argc > 0)
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 0084cf7400b..0ec6ca06e3b 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -987,7 +987,7 @@ int cmd_fsck(int argc,
if (name_objects)
fsck_enable_object_names(&fsck_walk_options);
- git_config(git_fsck_config, &fsck_obj_options);
+ repo_config(the_repository, git_fsck_config, &fsck_obj_options);
prepare_repo_settings(the_repository);
if (check_references)
diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c
index 0820e524f1a..469c62b555b 100644
--- a/builtin/fsmonitor--daemon.c
+++ b/builtin/fsmonitor--daemon.c
@@ -1547,7 +1547,7 @@ int cmd_fsmonitor__daemon(int argc,
OPT_END()
};
- git_config(fsmonitor_config, NULL);
+ repo_config(the_repository, fsmonitor_config, NULL);
argc = parse_options(argc, argv, prefix, options,
builtin_fsmonitor__daemon_usage, 0);
diff --git a/builtin/gc.c b/builtin/gc.c
index fab8f4dd4f7..d9e3b9d2ec3 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -228,7 +228,7 @@ static void gc_config(struct gc_config *cfg)
cfg->repack_filter_to = owned;
}
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
}
enum schedule_priority {
diff --git a/builtin/grep.c b/builtin/grep.c
index 39273d9c0fd..7982dda9a3b 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -1035,7 +1035,7 @@ int cmd_grep(int argc,
grep_prefix = prefix;
grep_init(&opt, the_repository);
- git_config(grep_cmd_config, &opt);
+ repo_config(the_repository, grep_cmd_config, &opt);
/*
* If there is no -- then the paths must exist in the working
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index ddf281413a6..c3ad1e91c96 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -111,7 +111,7 @@ int cmd_hash_object(int argc,
vpath = vpath_free;
}
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
if (stdin_paths) {
if (hashstdin)
diff --git a/builtin/help.c b/builtin/help.c
index c257079cebc..d79ecd946a6 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -210,7 +210,7 @@ static enum help_format parse_help_format(const char *format)
if (!strcmp(format, "web") || !strcmp(format, "html"))
return HELP_FORMAT_WEB;
/*
- * Please update _git_config() in git-completion.bash when you
+ * Please update _repo_config() in git-completion.bash when you
* add new help formats.
*/
die(_("unrecognized help format '%s'"), format);
@@ -706,7 +706,7 @@ int cmd_help(int argc,
}
setup_git_directory_gently(&nongit);
- git_config(git_help_config, NULL);
+ repo_config(the_repository, git_help_config, NULL);
if (parsed_help_format != HELP_FORMAT_NONE)
help_format = parsed_help_format;
diff --git a/builtin/hook.c b/builtin/hook.c
index 672d2e37e84..044c27aa95d 100644
--- a/builtin/hook.c
+++ b/builtin/hook.c
@@ -55,7 +55,7 @@ static int run(int argc, const char **argv, const char *prefix,
strvec_push(&opt.args, argv[i]);
/* Need to take into account core.hooksPath */
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
hook_name = argv[0];
if (!ignore_missing)
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 0a5c8a1ac85..53f1a7cd71e 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1917,7 +1917,7 @@ int cmd_index_pack(int argc,
reset_pack_idx_option(&opts);
opts.flags |= WRITE_REV;
- git_config(git_index_pack_config, &opts);
+ repo_config(the_repository, git_index_pack_config, &opts);
if (prefix && chdir(prefix))
die(_("Cannot come back to cwd"));
diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c
index 44d8ccddc9d..3141c37b853 100644
--- a/builtin/interpret-trailers.c
+++ b/builtin/interpret-trailers.c
@@ -220,7 +220,7 @@ int cmd_interpret_trailers(int argc,
OPT_END()
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options,
git_interpret_trailers_usage, 0);
diff --git a/builtin/log.c b/builtin/log.c
index 24a57c20a41..1bedc4ef355 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -659,10 +659,10 @@ int cmd_whatchanged(int argc,
log_config_init(&cfg);
init_diff_ui_defaults();
- git_config(git_log_config, &cfg);
+ repo_config(the_repository, git_log_config, &cfg);
repo_init_revisions(the_repository, &rev, prefix);
- git_config(grep_config, &rev.grep_filter);
+ repo_config(the_repository, grep_config, &rev.grep_filter);
rev.diff = 1;
rev.simplify_history = 0;
@@ -790,7 +790,7 @@ int cmd_show(int argc,
log_config_init(&cfg);
init_diff_ui_defaults();
- git_config(git_log_config, &cfg);
+ repo_config(the_repository, git_log_config, &cfg);
if (the_repository->gitdir) {
prepare_repo_settings(the_repository);
@@ -799,7 +799,7 @@ int cmd_show(int argc,
memset(&match_all, 0, sizeof(match_all));
repo_init_revisions(the_repository, &rev, prefix);
- git_config(grep_config, &rev.grep_filter);
+ repo_config(the_repository, grep_config, &rev.grep_filter);
rev.diff = 1;
rev.always_show_header = 1;
@@ -907,11 +907,11 @@ int cmd_log_reflog(int argc,
log_config_init(&cfg);
init_diff_ui_defaults();
- git_config(git_log_config, &cfg);
+ repo_config(the_repository, git_log_config, &cfg);
repo_init_revisions(the_repository, &rev, prefix);
init_reflog_walk(&rev.reflog_info);
- git_config(grep_config, &rev.grep_filter);
+ repo_config(the_repository, grep_config, &rev.grep_filter);
rev.verbose_header = 1;
memset(&opt, 0, sizeof(opt));
@@ -952,10 +952,10 @@ int cmd_log(int argc,
log_config_init(&cfg);
init_diff_ui_defaults();
- git_config(git_log_config, &cfg);
+ repo_config(the_repository, git_log_config, &cfg);
repo_init_revisions(the_repository, &rev, prefix);
- git_config(grep_config, &rev.grep_filter);
+ repo_config(the_repository, grep_config, &rev.grep_filter);
rev.always_show_header = 1;
memset(&opt, 0, sizeof(opt));
@@ -2158,9 +2158,9 @@ int cmd_format_patch(int argc,
format_config_init(&cfg);
init_diff_ui_defaults();
init_display_notes(&cfg.notes_opt);
- git_config(git_format_config, &cfg);
+ repo_config(the_repository, git_format_config, &cfg);
repo_init_revisions(the_repository, &rev, prefix);
- git_config(grep_config, &rev.grep_filter);
+ repo_config(the_repository, grep_config, &rev.grep_filter);
rev.show_notes = cfg.show_notes;
memcpy(&rev.notes_opt, &cfg.notes_opt, sizeof(cfg.notes_opt));
diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c
index 4d616dd5282..4ba84e51967 100644
--- a/builtin/ls-tree.c
+++ b/builtin/ls-tree.c
@@ -375,7 +375,7 @@ int cmd_ls_tree(int argc,
struct object_context obj_context = {0};
int ret;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, ls_tree_options,
ls_tree_usage, 0);
diff --git a/builtin/merge-base.c b/builtin/merge-base.c
index 123c81515e1..8fde35c1751 100644
--- a/builtin/merge-base.c
+++ b/builtin/merge-base.c
@@ -167,7 +167,7 @@ int cmd_merge_base(int argc,
OPT_END()
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0);
if (cmdmode == 'a') {
diff --git a/builtin/merge-file.c b/builtin/merge-file.c
index 9464f275629..3da4ca2c8cf 100644
--- a/builtin/merge-file.c
+++ b/builtin/merge-file.c
@@ -97,7 +97,7 @@ int cmd_merge_file(int argc,
if (startup_info->have_repository) {
/* Read the configuration file */
- git_config(git_xmerge_config, NULL);
+ repo_config(the_repository, git_xmerge_config, NULL);
if (0 <= git_xmerge_style)
xmp.style = git_xmerge_style;
}
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index cf8b06cadc7..99a6495fd52 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -683,7 +683,7 @@ int cmd_merge_tree(int argc,
if (argc != expected_remaining_argc)
usage_with_options(merge_tree_usage, mt_options);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
/* Do the relevant type of merge */
if (o.mode == MODE_REAL)
diff --git a/builtin/merge.c b/builtin/merge.c
index 18b22c0a26d..dc4cb8fb14d 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1392,7 +1392,7 @@ int cmd_merge(int argc,
skip_prefix(branch, "refs/heads/", &branch);
init_diff_ui_defaults();
- git_config(git_merge_config, NULL);
+ repo_config(the_repository, git_merge_config, NULL);
if (!branch || is_null_oid(&head_oid))
head_commit = NULL;
diff --git a/builtin/mktag.c b/builtin/mktag.c
index 27e649736cf..e078c97d032 100644
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
@@ -98,7 +98,7 @@ int cmd_mktag(int argc,
fsck_set_msg_type_from_ids(&fsck_options, FSCK_MSG_EXTRA_HEADER_ENTRY,
FSCK_WARN);
/* config might set fsck.extraHeaderEntry=* again */
- git_config(git_fsck_config, &fsck_options);
+ repo_config(the_repository, git_fsck_config, &fsck_options);
if (fsck_tag_standalone(NULL, buf.buf, buf.len, &fsck_options,
&tagged_oid, &tagged_type))
die(_("tag on stdin did not pass our strict fsck check"));
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index aa25b06f9d0..9a113f0f1f3 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -143,7 +143,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;
- git_config(git_multi_pack_index_write_config, NULL);
+ repo_config(the_repository, git_multi_pack_index_write_config, NULL);
options = add_common_options(builtin_multi_pack_index_write_options);
@@ -290,7 +290,7 @@ int cmd_multi_pack_index(int argc,
disable_replace_refs();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
if (the_repository &&
the_repository->objects &&
diff --git a/builtin/mv.c b/builtin/mv.c
index 07548fe96ae..d43925097b4 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -239,7 +239,7 @@ int cmd_mv(int argc,
struct strbuf pathbuf = STRBUF_INIT;
int ret;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, builtin_mv_options,
builtin_mv_usage, 0);
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index ff199638dee..74512e54a38 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -600,7 +600,7 @@ int cmd_name_rev(int argc,
mem_pool_init(&string_pool, 0);
init_commit_rev_name(&rev_names);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0);
#ifndef WITH_BREAKING_CHANGES
diff --git a/builtin/notes.c b/builtin/notes.c
index a9529b1696a..17004cdb10e 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -1145,7 +1145,7 @@ int cmd_notes(int argc,
OPT_END()
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, git_notes_usage,
PARSE_OPT_SUBCOMMAND_OPTIONAL);
if (!fn) {
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 5781dec9808..8c86ec2d89f 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -4924,7 +4924,7 @@ int cmd_pack_objects(int argc,
reset_pack_idx_option(&pack_idx_opts);
pack_idx_opts.flags |= WRITE_REV;
- git_config(git_pack_config, NULL);
+ repo_config(the_repository, git_pack_config, NULL);
if (git_env_bool(GIT_TEST_NO_WRITE_REV_INDEX, 0))
pack_idx_opts.flags &= ~WRITE_REV;
diff --git a/builtin/patch-id.c b/builtin/patch-id.c
index 26f04b0335d..a659f00531a 100644
--- a/builtin/patch-id.c
+++ b/builtin/patch-id.c
@@ -235,7 +235,7 @@ int cmd_patch_id(int argc,
OPT_END()
};
- git_config(git_patch_id_config, &config);
+ repo_config(the_repository, git_patch_id_config, &config);
/* verbatim implies stable */
if (config.verbatim)
diff --git a/builtin/pull.c b/builtin/pull.c
index c593f324fe7..d13ed9b5176 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -999,7 +999,7 @@ int cmd_pull(int argc,
if (!getenv("GIT_REFLOG_ACTION"))
set_reflog_message(argc, argv);
- git_config(git_pull_config, NULL);
+ repo_config(the_repository, git_pull_config, NULL);
if (the_repository->gitdir) {
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/push.c b/builtin/push.c
index 92d530e5c4d..d0794b7b305 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -598,7 +598,7 @@ int cmd_push(int argc,
};
packet_trace_identity("push");
- git_config(git_push_config, &flags);
+ repo_config(the_repository, git_push_config, &flags);
argc = parse_options(argc, argv, prefix, options, push_usage, 0);
push_options = (push_options_cmdline.nr
? &push_options_cmdline
diff --git a/builtin/range-diff.c b/builtin/range-diff.c
index 32ddb6613fb..a563abff5fe 100644
--- a/builtin/range-diff.c
+++ b/builtin/range-diff.c
@@ -54,7 +54,7 @@ int cmd_range_diff(int argc,
struct object_id oid;
const char *three_dots = NULL;
- git_config(git_diff_ui_config, NULL);
+ repo_config(the_repository, git_diff_ui_config, NULL);
repo_diff_setup(the_repository, &diffopt);
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index a8f352f7cd9..00eef756e67 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -168,7 +168,7 @@ int cmd_read_tree(int argc,
opts.src_index = the_repository->index;
opts.dst_index = the_repository->index;
- git_config(git_read_tree_config, NULL);
+ repo_config(the_repository, git_read_tree_config, NULL);
argc = parse_options(argc, argv, cmd_prefix, read_tree_options,
read_tree_usage, 0);
diff --git a/builtin/rebase.c b/builtin/rebase.c
index e90562a3b8a..0c3daa4b814 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1245,7 +1245,7 @@ int cmd_rebase(int argc,
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
- git_config(rebase_config, &options);
+ repo_config(the_repository, rebase_config, &options);
/* options.gpg_sign_opt will be either "-S" or NULL */
gpg_sign = options.gpg_sign_opt ? "" : NULL;
FREE_AND_NULL(options.gpg_sign_opt);
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 7974d157eb9..82d516a42c4 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -2613,7 +2613,7 @@ int cmd_receive_pack(int argc,
if (!enter_repo(service_dir, 0))
die("'%s' does not appear to be a git repository", service_dir);
- git_config(receive_pack_config, NULL);
+ repo_config(the_repository, receive_pack_config, NULL);
if (cert_nonce_seed)
push_cert_nonce = prepare_push_cert_nonce(service_dir, time(NULL));
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 3acaf3e32c2..4312f3d34c9 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -202,7 +202,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix,
OPT_END()
};
- git_config(reflog_expire_config, &opts);
+ repo_config(the_repository, reflog_expire_config, &opts);
save_commit_buffer = 0;
do_all = status = 0;
diff --git a/builtin/refs.c b/builtin/refs.c
index 998d2a2c1cc..c7ad0a2963a 100644
--- a/builtin/refs.c
+++ b/builtin/refs.c
@@ -88,7 +88,7 @@ static int cmd_refs_verify(int argc, const char **argv, const char *prefix,
if (argc)
usage(_("'git refs verify' takes no arguments"));
- git_config(git_fsck_config, &fsck_refs_options);
+ repo_config(the_repository, git_fsck_config, &fsck_refs_options);
prepare_repo_settings(the_repository);
worktrees = get_worktrees_without_reading_head();
diff --git a/builtin/remote.c b/builtin/remote.c
index 18843b6bf6c..ebd70bea3a1 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -353,7 +353,7 @@ static void read_branches(void)
{
if (branch_list.nr)
return;
- git_config(config_read_branches, NULL);
+ repo_config(the_repository, config_read_branches, NULL);
}
struct ref_states {
@@ -690,7 +690,7 @@ static void handle_push_default(const char* old_name, const char* new_name)
.origin = STRBUF_INIT,
.linenr = -1,
};
- git_config(config_read_push_default, &push_default);
+ repo_config(the_repository, config_read_push_default, &push_default);
if (push_default.scope >= CONFIG_SCOPE_COMMAND)
; /* pass */
else if (push_default.scope >= CONFIG_SCOPE_LOCAL) {
@@ -1620,7 +1620,7 @@ static int update(int argc, const char **argv, const char *prefix,
strvec_push(&cmd.args, argv[i]);
if (strcmp(cmd.args.v[cmd.args.nr-1], "default") == 0) {
- git_config(get_remote_default, &default_defined);
+ repo_config(the_repository, get_remote_default, &default_defined);
if (!default_defined) {
strvec_pop(&cmd.args);
strvec_push(&cmd.args, "--all");
diff --git a/builtin/repack.c b/builtin/repack.c
index b05ffe46239..dd1db282dac 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -1230,7 +1230,7 @@ int cmd_repack(int argc,
list_objects_filter_init(&po_args.filter_options);
- git_config(repack_config, &cruft_po_args);
+ repo_config(the_repository, repack_config, &cruft_po_args);
argc = parse_options(argc, argv, prefix, builtin_repack_options,
git_repack_usage, 0);
diff --git a/builtin/replace.c b/builtin/replace.c
index 5ff2ab723cb..3fe39e9df73 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -574,7 +574,7 @@ int cmd_replace(int argc,
};
disable_replace_refs();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0);
diff --git a/builtin/rerere.c b/builtin/rerere.c
index 1312e79d89f..a056cb791b4 100644
--- a/builtin/rerere.c
+++ b/builtin/rerere.c
@@ -66,7 +66,7 @@ int cmd_rerere(int argc,
argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
- git_config(git_xmerge_config, NULL);
+ repo_config(the_repository, git_xmerge_config, NULL);
if (autoupdate == 1)
flags = RERERE_AUTOUPDATE;
diff --git a/builtin/reset.c b/builtin/reset.c
index dc50ffc1ac5..00492c19b06 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -377,7 +377,7 @@ int cmd_reset(int argc,
OPT_END()
};
- git_config(git_reset_config, NULL);
+ repo_config(the_repository, git_reset_config, NULL);
argc = parse_options(argc, argv, prefix, options, git_reset_usage,
PARSE_OPT_KEEP_DASHDASH);
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 4d0c460f186..034ea0a558a 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -636,7 +636,7 @@ int cmd_rev_list(int argc,
show_usage_if_asked(argc, argv, rev_list_usage);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
repo_init_revisions(the_repository, &revs, prefix);
revs.abbrev = DEFAULT_ABBREV;
revs.commit_format = CMIT_FMT_UNSPECIFIED;
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 490da33becc..44ff1b8342a 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -734,7 +734,7 @@ int cmd_rev_parse(int argc,
/* No options; just report on whether we're in a git repo or not. */
if (argc == 1) {
setup_git_directory();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
return 0;
}
@@ -769,7 +769,7 @@ int cmd_rev_parse(int argc,
/* The rest of the options require a git repository. */
if (!did_repo_setup) {
prefix = setup_git_directory();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
did_repo_setup = 1;
prepare_repo_settings(the_repository);
diff --git a/builtin/rm.c b/builtin/rm.c
index a6565a69cfc..8c0da7a3ce7 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -271,7 +271,7 @@ int cmd_rm(int argc,
struct pathspec pathspec;
char *seen;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, builtin_rm_options,
builtin_rm_usage, 0);
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 60adc5e7a56..b91acf45c8f 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -421,7 +421,7 @@ int cmd_shortlog(int argc,
if (nongit && !the_hash_algo)
repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
shortlog_init(&log);
repo_init_revisions(the_repository, &rev, prefix);
parse_options_start(&ctx, argc, argv, prefix, options,
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 525b231d87e..1ab7db9d2ca 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -710,7 +710,7 @@ int cmd_show_branch(int ac,
init_commit_name_slab(&name_slab);
- git_config(git_show_branch_config, NULL);
+ repo_config(the_repository, git_show_branch_config, NULL);
/* If nothing is specified, try the default first */
if (ac == 1 && default_args.nr) {
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 117709cb076..414e55b92d5 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -324,7 +324,7 @@ struct repository *repo UNUSED)
OPT_END()
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, show_ref_options,
show_ref_usage, 0);
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
index 1bf01591b27..8c333b3e2e1 100644
--- a/builtin/sparse-checkout.c
+++ b/builtin/sparse-checkout.c
@@ -1082,7 +1082,7 @@ int cmd_sparse_checkout(int argc,
builtin_sparse_checkout_options,
builtin_sparse_checkout_usage, 0);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/stash.c b/builtin/stash.c
index e2f95cc2ebc..821b58a14e5 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -979,7 +979,7 @@ static int show_stash(int argc, const char **argv, const char *prefix,
int do_usage = 0;
init_diff_ui_defaults();
- git_config(git_diff_ui_config, NULL);
+ repo_config(the_repository, git_diff_ui_config, NULL);
repo_init_revisions(the_repository, &rev, prefix);
argc = parse_options(argc, argv, prefix, options, git_stash_show_usage,
@@ -2358,7 +2358,7 @@ int cmd_stash(int argc,
const char **args_copy;
int ret;
- git_config(git_stash_config, NULL);
+ repo_config(the_repository, git_stash_config, NULL);
argc = parse_options(argc, argv, prefix, options, git_stash_usage,
PARSE_OPT_SUBCOMMAND_OPTIONAL |
diff --git a/builtin/stripspace.c b/builtin/stripspace.c
index e147f3ff92c..4a566cbc5de 100644
--- a/builtin/stripspace.c
+++ b/builtin/stripspace.c
@@ -55,7 +55,7 @@ int cmd_stripspace(int argc,
if (mode == STRIP_COMMENTS || mode == COMMENT_LINES) {
setup_git_directory_gently(&nongit);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
}
if (strbuf_read(&buf, 0, 1024) < 0)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index d8a6fa47e59..89ee09abea6 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -649,7 +649,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
"--ignore-submodules=dirty", "--quiet", "--",
path, NULL);
- git_config(git_diff_basic_config, NULL);
+ repo_config(the_repository, git_diff_basic_config, NULL);
repo_init_revisions(the_repository, &rev, NULL);
rev.abbrev = 0;
@@ -1108,7 +1108,7 @@ static int compute_summary_module_list(struct object_id *head_oid,
if (info->argc)
strvec_pushv(&diff_args, info->argv);
- git_config(git_diff_basic_config, NULL);
+ repo_config(the_repository, git_diff_basic_config, NULL);
repo_init_revisions(the_repository, &rev, info->prefix);
rev.abbrev = 0;
precompose_argv_prefix(diff_args.nr, diff_args.v, NULL);
@@ -2830,7 +2830,7 @@ static int module_update(int argc, const char **argv, const char *prefix,
};
update_clone_config_from_gitmodules(&opt.max_jobs);
- git_config(git_update_clone_config, &opt.max_jobs);
+ repo_config(the_repository, git_update_clone_config, &opt.max_jobs);
argc = parse_options(argc, argv, prefix, module_update_options,
git_submodule_helper_usage, 0);
@@ -3128,7 +3128,7 @@ static int module_create_branch(int argc, const char **argv, const char *prefix,
NULL
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
track = git_branch_track;
argc = parse_options(argc, argv, prefix, options, usage, 0);
diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c
index 299d23d76a8..5c4623067c5 100644
--- a/builtin/symbolic-ref.c
+++ b/builtin/symbolic-ref.c
@@ -59,7 +59,7 @@ int cmd_symbolic_ref(int argc,
OPT_END(),
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options,
git_symbolic_ref_usage, 0);
if (msg && !*msg)
diff --git a/builtin/tag.c b/builtin/tag.c
index 46cbf892e34..25f30e3f9be 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -546,7 +546,7 @@ int cmd_tag(int argc,
* Try to set sort keys from config. If config does not set any,
* fall back on default (refname) sorting.
*/
- git_config(git_tag_config, &sorting_options);
+ repo_config(the_repository, git_tag_config, &sorting_options);
if (!sorting_options.nr)
string_list_append(&sorting_options, "refname");
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c
index 4360872ae07..ae871adc909 100644
--- a/builtin/unpack-file.c
+++ b/builtin/unpack-file.c
@@ -43,7 +43,7 @@ int cmd_unpack_file(int argc,
if (repo_get_oid(the_repository, argv[1], &oid))
die("Not a valid object name %s", argv[1]);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
puts(create_temp_file(&oid));
return 0;
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index a69d59eb50c..26aa885da92 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -621,7 +621,7 @@ int cmd_unpack_objects(int argc,
disable_replace_refs();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
quiet = !isatty(2);
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 0c1d4ed55be..2380f3ccd68 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -1103,7 +1103,7 @@ int cmd_update_index(int argc,
show_usage_with_options_if_asked(argc, argv,
update_index_usage, options);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
prepare_repo_settings(r);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index 1e6131e04ad..cb936643243 100644
--- a/builtin/update-ref.c
+++ b/builtin/update-ref.c
@@ -769,7 +769,7 @@ int cmd_update_ref(int argc,
OPT_END(),
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, git_update_ref_usage,
0);
if (msg && !*msg)
diff --git a/builtin/var.c b/builtin/var.c
index ada642a9fe5..beeac12dccf 100644
--- a/builtin/var.c
+++ b/builtin/var.c
@@ -226,11 +226,11 @@ int cmd_var(int argc,
usage(var_usage);
if (strcmp(argv[1], "-l") == 0) {
- git_config(show_config, NULL);
+ repo_config(the_repository, show_config, NULL);
list_vars();
return 0;
}
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
git_var = get_git_var(argv[1]);
if (!git_var)
diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c
index 34e4ed715f3..d9f66f5e767 100644
--- a/builtin/verify-pack.c
+++ b/builtin/verify-pack.c
@@ -81,7 +81,7 @@ int cmd_verify_pack(int argc,
OPT_END()
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, verify_pack_options,
verify_pack_usage, 0);
if (argc < 1)
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 2dceeeed8bd..b1306248dec 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -1448,7 +1448,7 @@ int cmd_worktree(int ac,
OPT_END()
};
- git_config(git_worktree_config, NULL);
+ repo_config(the_repository, git_worktree_config, NULL);
if (!prefix)
prefix = "";
diff --git a/builtin/write-tree.c b/builtin/write-tree.c
index cfec044710a..3465c70a48a 100644
--- a/builtin/write-tree.c
+++ b/builtin/write-tree.c
@@ -43,7 +43,7 @@ int cmd_write_tree(int argc,
OPT_END()
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, cmd_prefix, write_tree_options,
write_tree_usage, 0);
diff --git a/config.h b/config.h
index 29a02774837..6b729fc6bbf 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline void git_config(config_fn_t fn, void *data)
-{
- repo_config(the_repository, fn, data);
-}
-
static inline void git_config_clear(void)
{
repo_config_clear(the_repository);
diff --git a/connect.c b/connect.c
index e77287f426c..4b1dc65e5ce 100644
--- a/connect.c
+++ b/connect.c
@@ -1028,7 +1028,7 @@ static int git_proxy_command_options(const char *var, const char *value,
static int git_use_proxy(const char *host)
{
git_proxy_command = getenv("GIT_PROXY_COMMAND");
- git_config(git_proxy_command_options, (void*)host);
+ repo_config(the_repository, git_proxy_command_options, (void*)host);
return (git_proxy_command && *git_proxy_command);
}
diff --git a/contrib/coccinelle/config_fn_ctx.pending.cocci b/contrib/coccinelle/config_fn_ctx.pending.cocci
index 6d3d1000a96..54f09fcbcde 100644
--- a/contrib/coccinelle/config_fn_ctx.pending.cocci
+++ b/contrib/coccinelle/config_fn_ctx.pending.cocci
@@ -83,7 +83,7 @@ int fn(const char *C1, const char *C2,
// The previous rules don't catch all callbacks, especially if they're defined
-// in a separate file from the git_config() call. Fix these manually.
+// in a separate file from the repo_config() call. Fix these manually.
@@
identifier C1, C2, D;
attribute name UNUSED;
diff --git a/convert.c b/convert.c
index b5f7cf6306c..c7d6a85c226 100644
--- a/convert.c
+++ b/convert.c
@@ -1326,7 +1326,7 @@ void convert_attrs(struct index_state *istate,
"eol", "text", "working-tree-encoding",
NULL);
user_convert_tail = &user_convert;
- git_config(read_convert_config, NULL);
+ repo_config(the_repository, read_convert_config, NULL);
}
git_check_attr(istate, path, check);
diff --git a/fetch-pack.c b/fetch-pack.c
index 01d3699c4b7..11344206f73 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1916,7 +1916,7 @@ static void fetch_pack_config(void)
}
}
- git_config(fetch_pack_config_cb, NULL);
+ repo_config(the_repository, fetch_pack_config_cb, NULL);
}
static void fetch_pack_setup(void)
diff --git a/fsck.h b/fsck.h
index 0c5869ac34e..dd7df3d5b36 100644
--- a/fsck.h
+++ b/fsck.h
@@ -287,7 +287,7 @@ const char *fsck_describe_object(struct fsck_options *options,
struct key_value_info;
/*
- * git_config() callback for use by fsck-y tools that want to support
+ * repo_config() callback for use by fsck-y tools that want to support
* fsck.<msg> fsck.skipList etc.
*/
int git_fsck_config(const char *var, const char *value,
diff --git a/gpg-interface.c b/gpg-interface.c
index bdcc8c2a2ed..bc0c21ebab1 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -25,7 +25,7 @@ static void gpg_interface_lazy_init(void)
if (done)
return;
done = 1;
- git_config(git_gpg_config, NULL);
+ repo_config(the_repository, git_gpg_config, NULL);
}
static char *configured_signing_key;
diff --git a/help.c b/help.c
index 652efebf00c..db62cda4442 100644
--- a/help.c
+++ b/help.c
@@ -332,7 +332,7 @@ static int get_colopts(const char *var, const char *value,
void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds)
{
unsigned int colopts = 0;
- git_config(get_colopts, &colopts);
+ repo_config(the_repository, get_colopts, &colopts);
if (main_cmds->cnt) {
const char *exec_path = git_exec_path();
@@ -502,7 +502,7 @@ static void list_all_cmds_help_aliases(int longest)
struct cmdname_help *aliases;
int i;
- git_config(get_alias, &alias_list);
+ repo_config(the_repository, get_alias, &alias_list);
string_list_sort(&alias_list);
for (i = 0; i < alias_list.nr; i++) {
diff --git a/http-fetch.c b/http-fetch.c
index 02ab80533f0..17b9fe4ff8c 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -150,7 +150,7 @@ int cmd_main(int argc, const char **argv)
trace2_cmd_name("http-fetch");
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
if (packfile) {
if (!index_pack_args.nr)
diff --git a/http.c b/http.c
index 9b62f627dc5..d94e8f63b57 100644
--- a/http.c
+++ b/http.c
@@ -1315,7 +1315,7 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
http_is_verbose = 0;
normalized_url = url_normalize(url, &config.url);
- git_config(urlmatch_config_entry, &config);
+ repo_config(the_repository, urlmatch_config_entry, &config);
free(normalized_url);
string_list_clear(&config.vars, 1);
diff --git a/imap-send.c b/imap-send.c
index f5a656ac71d..9b26c669c01 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1776,7 +1776,7 @@ int cmd_main(int argc, const char **argv)
int ret;
setup_git_directory_gently(&nongit_ok);
- git_config(git_imap_config, &server);
+ repo_config(the_repository, git_imap_config, &server);
argc = parse_options(argc, (const char **)argv, "", imap_send_options, imap_send_usage, 0);
diff --git a/ls-refs.c b/ls-refs.c
index e28c8413758..c47acde07f3 100644
--- a/ls-refs.c
+++ b/ls-refs.c
@@ -159,7 +159,7 @@ int ls_refs(struct repository *r, struct packet_reader *request)
strbuf_init(&data.buf, 0);
strvec_init(&data.hidden_refs);
- git_config(ls_refs_config, &data);
+ repo_config(the_repository, ls_refs_config, &data);
while (packet_reader_read(request) == PACKET_READ_NORMAL) {
const char *arg = request->line;
diff --git a/merge-ll.c b/merge-ll.c
index b2dc26da4fe..fafe2c91971 100644
--- a/merge-ll.c
+++ b/merge-ll.c
@@ -357,7 +357,7 @@ static void initialize_ll_merge(void)
if (ll_user_merge_tail)
return;
ll_user_merge_tail = &ll_user_merge;
- git_config(read_merge_config, NULL);
+ repo_config(the_repository, read_merge_config, NULL);
}
static const struct ll_merge_driver *find_ll_merge_driver(const char *merge_attr)
diff --git a/merge-ort.c b/merge-ort.c
index 473ff61e36e..49aa37a8f23 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -5387,7 +5387,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)
free(value);
}
}
- git_config(git_xmerge_config, NULL);
+ repo_config(the_repository, git_xmerge_config, NULL);
}
static void init_merge_options(struct merge_options *opt,
diff --git a/notes-utils.c b/notes-utils.c
index ac66b82dd31..6a50c6d5646 100644
--- a/notes-utils.c
+++ b/notes-utils.c
@@ -162,7 +162,7 @@ struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd)
c->refs_from_env = 1;
string_list_add_refs_from_colon_sep(c->refs, rewrite_refs_env);
}
- git_config(notes_rewrite_config, c);
+ repo_config(the_repository, notes_rewrite_config, c);
if (!c->enabled || !c->refs->nr) {
string_list_clear(c->refs, 0);
free(c->refs);
diff --git a/notes.c b/notes.c
index 97b995f3f2d..49393fbfd8d 100644
--- a/notes.c
+++ b/notes.c
@@ -1123,7 +1123,7 @@ void load_display_notes(struct display_notes_opt *opt)
load_config_refs = 1;
}
- git_config(notes_display_config, &load_config_refs);
+ repo_config(the_repository, notes_display_config, &load_config_refs);
if (opt) {
struct string_list_item *item;
diff --git a/pretty.c b/pretty.c
index 0bc8ad8a9a8..cee96b9d94d 100644
--- a/pretty.c
+++ b/pretty.c
@@ -141,7 +141,7 @@ static void setup_commit_formats(void)
COPY_ARRAY(commit_formats, builtin_formats,
ARRAY_SIZE(builtin_formats));
- git_config(git_pretty_formats_config, NULL);
+ repo_config(the_repository, git_pretty_formats_config, NULL);
}
static struct cmt_fmt_map *find_commit_format_recursive(const char *sought,
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
index 4c3817f4ec1..5134781d52d 100644
--- a/refs/reftable-backend.c
+++ b/refs/reftable-backend.c
@@ -386,7 +386,7 @@ static struct ref_store *reftable_be_init(struct repository *repo,
refs->write_options.lock_timeout_ms = 100;
refs->write_options.fsync = reftable_be_fsync;
- git_config(reftable_be_config, &refs->write_options);
+ repo_config(the_repository, reftable_be_config, &refs->write_options);
/*
* It is somewhat unfortunate that we have to mirror the default block
diff --git a/rerere.c b/rerere.c
index 8bb97c98229..1ac2075144c 100644
--- a/rerere.c
+++ b/rerere.c
@@ -879,7 +879,7 @@ static void git_rerere_config(void)
{
git_config_get_bool("rerere.enabled", &rerere_enabled);
git_config_get_bool("rerere.autoupdate", &rerere_autoupdate);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
}
static GIT_PATH_FUNC(git_path_rr_cache, "rr-cache")
@@ -1247,7 +1247,7 @@ void rerere_gc(struct repository *r, struct string_list *rr)
&cutoff_resolve, now);
repo_config_get_expiry_in_days(the_repository, "gc.rerereunresolved",
&cutoff_noresolve, now);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
dir = opendir(repo_git_path_replace(the_repository, &buf, "rr-cache"));
if (!dir)
die_errno(_("unable to open rr-cache directory"));
diff --git a/revision.c b/revision.c
index 0ca6a297a6b..ad63c100eb9 100644
--- a/revision.c
+++ b/revision.c
@@ -1636,7 +1636,7 @@ void exclude_hidden_refs(struct ref_exclusions *exclusions, const char *section)
cb.exclusions = exclusions;
cb.section = section;
- git_config(hide_refs_config, &cb);
+ repo_config(the_repository, hide_refs_config, &cb);
}
struct all_refs_cb {
diff --git a/scalar.c b/scalar.c
index 0dc79fa9fb0..3b713abca3c 100644
--- a/scalar.c
+++ b/scalar.c
@@ -713,7 +713,7 @@ static int cmd_reconfigure(int argc, const char **argv)
maintenance_str);
}
- git_config(get_scalar_repos, &scalar_repos);
+ repo_config(the_repository, get_scalar_repos, &scalar_repos);
for (size_t i = 0; i < scalar_repos.nr; i++) {
int succeeded = 0;
diff --git a/sequencer.c b/sequencer.c
index 67e4310edcf..df207f33e07 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -327,7 +327,7 @@ static int git_sequencer_config(const char *k, const char *v,
void sequencer_init_config(struct replay_opts *opts)
{
opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE;
- git_config(git_sequencer_config, opts);
+ repo_config(the_repository, git_sequencer_config, opts);
}
static inline int is_rebase_i(const struct replay_opts *opts)
diff --git a/setup.c b/setup.c
index 6f52dab64ca..91a3affdd8f 100644
--- a/setup.c
+++ b/setup.c
@@ -2339,7 +2339,7 @@ static int create_default_files(const char *template_path,
copy_templates(template_path);
git_config_clear();
repo_settings_reset_shared_repository(the_repository);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
reinit = is_reinit();
@@ -2610,7 +2610,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
* have set up the repository format such that we can evaluate
* includeIf conditions correctly in the case of re-initialization.
*/
- git_config(platform_core_config, NULL);
+ repo_config(the_repository, platform_core_config, NULL);
safe_create_dir(the_repository, git_dir, 0);
diff --git a/t/helper/test-advise.c b/t/helper/test-advise.c
index 6967c8e25c6..77c15a46cfa 100644
--- a/t/helper/test-advise.c
+++ b/t/helper/test-advise.c
@@ -11,7 +11,7 @@ int cmd__advise_if_enabled(int argc, const char **argv)
die("usage: %s <advice>", argv[0]);
setup_git_directory();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
/*
* Any advice type can be used for testing, but NESTED_TAG was
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 75e028ab2a0..41ba8647900 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -32,10 +32,10 @@
* ascending order of priority from a config_set
* constructed from files entered as arguments.
*
- * iterate -> iterate over all values using git_config(), and print some
+ * iterate -> iterate over all values using repo_config(), and print some
* data for each
*
- * git_config_int -> iterate over all values using git_config() and print the
+ * git_config_int -> iterate over all values using repo_config() and print the
* integer value for the entered key or die
*
* Examples:
@@ -218,10 +218,10 @@ int cmd__config(int argc, const char **argv)
goto exit1;
}
} else if (!strcmp(argv[1], "iterate")) {
- git_config(iterate_cb, NULL);
+ repo_config(the_repository, iterate_cb, NULL);
goto exit0;
} else if (argc == 3 && !strcmp(argv[1], "git_config_int")) {
- git_config(parse_int_cb, (void *) argv[2]);
+ repo_config(the_repository, parse_int_cb, (void *) argv[2]);
goto exit0;
}
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index e277dde8e71..b2da48eda05 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -19,7 +19,7 @@ int cmd__read_cache(int argc, const char **argv)
if (argc == 2)
cnt = strtol(argv[1], NULL, 0);
setup_git_directory();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
for (i = 0; i < cnt; i++) {
repo_read_index(the_repository);
diff --git a/t/helper/test-userdiff.c b/t/helper/test-userdiff.c
index 94c48ababbe..aa3a9894d25 100644
--- a/t/helper/test-userdiff.c
+++ b/t/helper/test-userdiff.c
@@ -41,7 +41,7 @@ int cmd__userdiff(int argc, const char **argv)
if (want & USERDIFF_DRIVER_TYPE_CUSTOM) {
setup_git_directory();
- git_config(cmd__userdiff_config, NULL);
+ repo_config(the_repository, cmd__userdiff_config, NULL);
}
for_each_userdiff_driver(driver_cb, &want);
diff --git a/t/t4256/1/mailinfo.c b/t/t4256/1/mailinfo.c
index b395adbdf2a..39caeba8653 100644
--- a/t/t4256/1/mailinfo.c
+++ b/t/t4256/1/mailinfo.c
@@ -1214,7 +1214,7 @@ void setup_mailinfo(struct mailinfo *mi)
mi->header_stage = 1;
mi->use_inbody_headers = 1;
mi->content_top = mi->content;
- git_config(git_mailinfo_config, mi);
+ repo_config(the_repository, git_mailinfo_config, mi);
}
void clear_mailinfo(struct mailinfo *mi)
diff --git a/t/t4256/1/mailinfo.c.orig b/t/t4256/1/mailinfo.c.orig
index 3281a37d518..b76eb866aae 100644
--- a/t/t4256/1/mailinfo.c.orig
+++ b/t/t4256/1/mailinfo.c.orig
@@ -1154,7 +1154,7 @@ void setup_mailinfo(struct mailinfo *mi)
mi->header_stage = 1;
mi->use_inbody_headers = 1;
mi->content_top = mi->content;
- git_config(git_mailinfo_config, mi);
+ repo_config(the_repository, git_mailinfo_config, mi);
}
void clear_mailinfo(struct mailinfo *mi)
diff --git a/trailer.c b/trailer.c
index 310cf582dc3..911a81ed993 100644
--- a/trailer.c
+++ b/trailer.c
@@ -595,8 +595,8 @@ void trailer_config_init(void)
default_conf_info.where = WHERE_END;
default_conf_info.if_exists = EXISTS_ADD_IF_DIFFERENT_NEIGHBOR;
default_conf_info.if_missing = MISSING_ADD;
- git_config(git_trailer_default_config, NULL);
- git_config(git_trailer_config, NULL);
+ repo_config(the_repository, git_trailer_default_config, NULL);
+ repo_config(the_repository, git_trailer_config, NULL);
configured = 1;
}
diff --git a/transport.c b/transport.c
index c123ac1e38b..a246afd09fa 100644
--- a/transport.c
+++ b/transport.c
@@ -202,7 +202,7 @@ static int fetch_refs_from_bundle(struct transport *transport,
if (!data->get_refs_from_bundle_called)
get_refs_from_bundle_inner(transport);
- git_config(fetch_fsck_config_cb, &msg_types);
+ repo_config(the_repository, fetch_fsck_config_cb, &msg_types);
opts.fsck_msg_types = msg_types.buf;
ret = unbundle(the_repository, &data->header, data->fd,
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 02/21] config: drop `git_config_clear()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 01/21] config: drop `git_config()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 03/21] config: drop `git_config_get()` wrapper Patrick Steinhardt
` (19 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_clear()`. All
callsites are adjusted so that they use
`repo_config_clear(the_repository, ...)` instead. While some callsites
might already have a repository available, this mechanical conversion is
the exact same as the current situation and thus cannot cause any
regression. Those sites should eventually be cleaned up in a later patch
series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
config.h | 5 -----
scalar.c | 2 +-
setup.c | 4 ++--
3 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/config.h b/config.h
index 6b729fc6bbf..4eea99e9b95 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline void git_config_clear(void)
-{
- repo_config_clear(the_repository);
-}
-
static inline int git_config_get(const char *key)
{
return repo_config_get(the_repository, key);
diff --git a/scalar.c b/scalar.c
index 3b713abca3c..2aaff5aa109 100644
--- a/scalar.c
+++ b/scalar.c
@@ -763,7 +763,7 @@ static int cmd_reconfigure(int argc, const char **argv)
break;
}
- git_config_clear();
+ repo_config_clear(the_repository);
if (repo_init(&r, gitdir.buf, commondir.buf))
goto loop_end;
diff --git a/setup.c b/setup.c
index 91a3affdd8f..9661c5d5d5d 100644
--- a/setup.c
+++ b/setup.c
@@ -1741,7 +1741,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
* configuration (including the per-repo config file that we
* ignored previously).
*/
- git_config_clear();
+ repo_config_clear(the_repository);
/*
* Let's assume that we are in a git repository.
@@ -2337,7 +2337,7 @@ static int create_default_files(const char *template_path,
* disk).
*/
copy_templates(template_path);
- git_config_clear();
+ repo_config_clear(the_repository);
repo_settings_reset_shared_repository(the_repository);
repo_config(the_repository, git_default_config, NULL);
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 03/21] config: drop `git_config_get()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 01/21] config: drop `git_config()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 02/21] config: drop `git_config_clear()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 04/21] config: drop `git_config_get_value()` wrapper Patrick Steinhardt
` (18 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get()`. All
callsites are adjusted so that they use `repo_config_get(the_repository,
...)` instead. While some callsites might already have a repository
available, this mechanical conversion is the exact same as the current
situation and thus cannot cause any regression. Those sites should
eventually be cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/gc.c | 2 +-
builtin/submodule--helper.c | 6 +++---
config.h | 5 -----
t/helper/test-config.c | 2 +-
4 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index d9e3b9d2ec3..e5c3d082eda 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1916,7 +1916,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
git_config_set("maintenance.auto", "false");
/* Set maintenance strategy, if unset */
- if (git_config_get("maintenance.strategy"))
+ if (repo_config_get(the_repository, "maintenance.strategy"))
git_config_set("maintenance.strategy", "incremental");
if (!git_config_get_string_multi(key, &list)) {
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 89ee09abea6..6bcc741a6ac 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -549,7 +549,7 @@ static int module_init(int argc, const char **argv, const char *prefix,
* If there are no path args and submodule.active is set then,
* by default, only initialize 'active' modules.
*/
- if (!argc && !git_config_get("submodule.active"))
+ if (!argc && !repo_config_get(the_repository, "submodule.active"))
module_list_active(&list);
info.prefix = prefix;
@@ -2878,7 +2878,7 @@ static int module_update(int argc, const char **argv, const char *prefix,
* If there are no path args and submodule.active is set then,
* by default, only initialize 'active' modules.
*/
- if (!argc && !git_config_get("submodule.active"))
+ if (!argc && !repo_config_get(the_repository, "submodule.active"))
module_list_active(&list);
info.prefix = opt.prefix;
@@ -3349,7 +3349,7 @@ static void configure_added_submodule(struct add_data *add_data)
* is_submodule_active(), since that function needs to find
* out the value of "submodule.active" again anyway.
*/
- if (!git_config_get("submodule.active")) {
+ if (!repo_config_get(the_repository, "submodule.active")) {
/*
* If the submodule being added isn't already covered by the
* current configured pathspec, set the submodule's active flag
diff --git a/config.h b/config.h
index 4eea99e9b95..9261ed0f8d7 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get(const char *key)
-{
- return repo_config_get(the_repository, key);
-}
-
static inline int git_config_get_value(const char *key, const char **value)
{
return repo_config_get_value(the_repository, key, value);
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 41ba8647900..cacf6f306b1 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -137,7 +137,7 @@ int cmd__config(int argc, const char **argv)
} else if (argc == 3 && !strcmp(argv[1], "get")) {
int ret;
- if (!(ret = git_config_get(argv[2])))
+ if (!(ret = repo_config_get(the_repository, argv[2])))
goto exit0;
else if (ret == 1)
printf("Value not found for \"%s\"\n", argv[2]);
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 04/21] config: drop `git_config_get_value()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (2 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 03/21] config: drop `git_config_get()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 05/21] " Patrick Steinhardt
` (17 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_value()`. All
callsites are adjusted so that they use
`repo_config_get_value(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/gc.c | 4 ++--
builtin/pull.c | 6 +++---
config.h | 5 -----
rebase-interactive.c | 2 +-
t/helper/test-config.c | 2 +-
5 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index e5c3d082eda..e94931ff48f 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -114,7 +114,7 @@ static int gc_config_is_timestamp_never(const char *var)
const char *value;
timestamp_t expire;
- if (!git_config_get_value(var, &value) && value) {
+ if (!repo_config_get_value(the_repository, var, &value) && value) {
if (parse_expiry_date(value, &expire))
die(_("failed to parse '%s' value '%s'"), var, value);
return expire == 0;
@@ -178,7 +178,7 @@ static void gc_config(struct gc_config *cfg)
char *owned = NULL;
unsigned long ulongval;
- if (!git_config_get_value("gc.packrefs", &value)) {
+ if (!repo_config_get_value(the_repository, "gc.packrefs", &value)) {
if (value && !strcmp(value, "notbare"))
cfg->pack_refs = -1;
else
diff --git a/builtin/pull.c b/builtin/pull.c
index d13ed9b5176..5ea51c31f58 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -312,7 +312,7 @@ static const char *config_get_ff(void)
{
const char *value;
- if (git_config_get_value("pull.ff", &value))
+ if (repo_config_get_value(the_repository, "pull.ff", &value))
return NULL;
switch (git_parse_maybe_bool(value)) {
@@ -343,7 +343,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)
if (curr_branch) {
char *key = xstrfmt("branch.%s.rebase", curr_branch->name);
- if (!git_config_get_value(key, &value)) {
+ if (!repo_config_get_value(the_repository, key, &value)) {
enum rebase_type ret = parse_config_rebase(key, value, 1);
free(key);
return ret;
@@ -352,7 +352,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)
free(key);
}
- if (!git_config_get_value("pull.rebase", &value))
+ if (!repo_config_get_value(the_repository, "pull.rebase", &value))
return parse_config_rebase("pull.rebase", value, 1);
*rebase_unspecified = 1;
diff --git a/config.h b/config.h
index 9261ed0f8d7..5dc330b88b1 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_value(const char *key, const char **value)
-{
- return repo_config_get_value(the_repository, key, value);
-}
-
static inline int git_config_get_value_multi(const char *key, const struct string_list **dest)
{
return repo_config_get_value_multi(the_repository, key, dest);
diff --git a/rebase-interactive.c b/rebase-interactive.c
index cbeb8641477..809f76a87b8 100644
--- a/rebase-interactive.c
+++ b/rebase-interactive.c
@@ -30,7 +30,7 @@ static enum missing_commit_check_level get_missing_commit_check_level(void)
{
const char *value;
- if (git_config_get_value("rebase.missingcommitscheck", &value) ||
+ if (repo_config_get_value(the_repository, "rebase.missingcommitscheck", &value) ||
!strcasecmp("ignore", value))
return MISSING_COMMIT_CHECK_IGNORE;
if (!strcasecmp("warn", value))
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index cacf6f306b1..99c91512173 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -110,7 +110,7 @@ int cmd__config(int argc, const char **argv)
fprintf(stderr, "Please, provide a command name on the command-line\n");
goto exit1;
} else if (argc == 3 && !strcmp(argv[1], "get_value")) {
- if (!git_config_get_value(argv[2], &v)) {
+ if (!repo_config_get_value(the_repository, argv[2], &v)) {
if (!v)
printf("(NULL)\n");
else
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 05/21] config: drop `git_config_get_value()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (3 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 04/21] config: drop `git_config_get_value()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 06/21] config: drop `git_config_get_string_multi()` wrapper Patrick Steinhardt
` (16 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_value()`. All
callsites are adjusted so that they use
`repo_config_get_value(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
config.h | 5 -----
t/helper/test-config.c | 2 +-
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/config.h b/config.h
index 5dc330b88b1..e90c1c4d335 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_value_multi(const char *key, const struct string_list **dest)
-{
- return repo_config_get_value_multi(the_repository, key, dest);
-}
-
static inline int git_config_get_string_multi(const char *key,
const struct string_list **dest)
{
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 99c91512173..1953ab846e4 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -121,7 +121,7 @@ int cmd__config(int argc, const char **argv)
goto exit1;
}
} else if (argc == 3 && !strcmp(argv[1], "get_value_multi")) {
- if (!git_config_get_value_multi(argv[2], &strptr)) {
+ if (!repo_config_get_value_multi(the_repository, argv[2], &strptr)) {
for (i = 0; i < strptr->nr; i++) {
v = strptr->items[i].string;
if (!v)
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 06/21] config: drop `git_config_get_string_multi()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (4 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 05/21] " Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 07/21] config: drop `git_config_get_string()` wrapper Patrick Steinhardt
` (15 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove
`git_config_get_string_multi()`. All callsites are adjusted so that they
use `repo_config_get_string_multi(the_repository, ...)` instead. While
some callsites might already have a repository available, this
mechanical conversion is the exact same as the current situation and
thus cannot cause any regression. Those sites should eventually be
cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/gc.c | 4 ++--
builtin/log.c | 2 +-
config.h | 6 ------
reachable.c | 2 +-
versioncmp.c | 4 ++--
5 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index e94931ff48f..f395cc57a15 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1919,7 +1919,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
if (repo_config_get(the_repository, "maintenance.strategy"))
git_config_set("maintenance.strategy", "incremental");
- if (!git_config_get_string_multi(key, &list)) {
+ if (!repo_config_get_string_multi(the_repository, key, &list)) {
for_each_string_list_item(item, list) {
if (!strcmp(maintpath, item->string)) {
found = 1;
@@ -1988,7 +1988,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
}
if (!(config_file
? git_configset_get_string_multi(&cs, key, &list)
- : git_config_get_string_multi(key, &list))) {
+ : repo_config_get_string_multi(the_repository, key, &list))) {
for_each_string_list_item(item, list) {
if (!strcmp(maintpath, item->string)) {
found = 1;
diff --git a/builtin/log.c b/builtin/log.c
index 1bedc4ef355..b512f12e805 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -221,7 +221,7 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
struct string_list *include = decoration_filter->include_ref_pattern;
const struct string_list *config_exclude;
- if (!git_config_get_string_multi("log.excludeDecoration",
+ if (!repo_config_get_string_multi(the_repository, "log.excludeDecoration",
&config_exclude)) {
struct string_list_item *item;
for_each_string_list_item(item, config_exclude)
diff --git a/config.h b/config.h
index e90c1c4d335..f6635e48c23 100644
--- a/config.h
+++ b/config.h
@@ -719,12 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_string_multi(const char *key,
- const struct string_list **dest)
-{
- return repo_config_get_string_multi(the_repository, key, dest);
-}
-
static inline int git_config_get_string(const char *key, char **dest)
{
return repo_config_get_string(the_repository, key, dest);
diff --git a/reachable.c b/reachable.c
index e984b68a0c4..8330a14fa82 100644
--- a/reachable.c
+++ b/reachable.c
@@ -170,7 +170,7 @@ static void load_gc_recent_objects(struct recent_data *data)
data->extra_recent_oids_loaded = 1;
- if (git_config_get_string_multi("gc.recentobjectshook", &programs))
+ if (repo_config_get_string_multi(the_repository, "gc.recentobjectshook", &programs))
return;
for (i = 0; i < programs->nr; i++) {
diff --git a/versioncmp.c b/versioncmp.c
index b6eebdb989c..3a81b17bc1b 100644
--- a/versioncmp.c
+++ b/versioncmp.c
@@ -167,8 +167,8 @@ int versioncmp(const char *s1, const char *s2)
const char *const oldk = "versionsort.prereleasesuffix";
const struct string_list *newl;
const struct string_list *oldl;
- int new = git_config_get_string_multi(newk, &newl);
- int old = git_config_get_string_multi(oldk, &oldl);
+ int new = repo_config_get_string_multi(the_repository, newk, &newl);
+ int old = repo_config_get_string_multi(the_repository, oldk, &oldl);
if (!new && !old)
warning("ignoring %s because %s is set", oldk, newk);
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 07/21] config: drop `git_config_get_string()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (5 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 06/21] config: drop `git_config_get_string_multi()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 08/21] " Patrick Steinhardt
` (14 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_string()`.
All callsites are adjusted so that they use
`repo_config_get_string(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
apply.c | 4 ++--
branch.c | 2 +-
builtin/gc.c | 4 ++--
builtin/log.c | 2 +-
builtin/notes.c | 2 +-
builtin/submodule--helper.c | 12 ++++++------
config.h | 5 -----
fetch-pack.c | 2 +-
merge-ort.c | 8 ++++----
scalar.c | 4 ++--
sequencer.c | 2 +-
transport.c | 8 ++++----
12 files changed, 25 insertions(+), 30 deletions(-)
diff --git a/apply.c b/apply.c
index d2381a157c0..45eb790d133 100644
--- a/apply.c
+++ b/apply.c
@@ -48,8 +48,8 @@ struct gitdiff_data {
static void git_apply_config(void)
{
- git_config_get_string("apply.whitespace", &apply_default_whitespace);
- git_config_get_string("apply.ignorewhitespace", &apply_default_ignorewhitespace);
+ repo_config_get_string(the_repository, "apply.whitespace", &apply_default_whitespace);
+ repo_config_get_string(the_repository, "apply.ignorewhitespace", &apply_default_ignorewhitespace);
repo_config(the_repository, git_xmerge_config, NULL);
}
diff --git a/branch.c b/branch.c
index 93f5b4e8dd9..b4811671fc7 100644
--- a/branch.c
+++ b/branch.c
@@ -355,7 +355,7 @@ int read_branch_desc(struct strbuf *buf, const char *branch_name)
char *v = NULL;
struct strbuf name = STRBUF_INIT;
strbuf_addf(&name, "branch.%s.description", branch_name);
- if (git_config_get_string(name.buf, &v)) {
+ if (repo_config_get_string(the_repository, name.buf, &v)) {
strbuf_release(&name);
return -1;
}
diff --git a/builtin/gc.c b/builtin/gc.c
index f395cc57a15..d8f7a1858cb 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -218,12 +218,12 @@ static void gc_config(struct gc_config *cfg)
if (!git_config_get_ulong("core.deltabasecachelimit", &ulongval))
cfg->delta_base_cache_limit = ulongval;
- if (!git_config_get_string("gc.repackfilter", &owned)) {
+ if (!repo_config_get_string(the_repository, "gc.repackfilter", &owned)) {
free(cfg->repack_filter);
cfg->repack_filter = owned;
}
- if (!git_config_get_string("gc.repackfilterto", &owned)) {
+ if (!repo_config_get_string(the_repository, "gc.repackfilterto", &owned)) {
free(cfg->repack_filter_to);
cfg->repack_filter_to = owned;
}
diff --git a/builtin/log.c b/builtin/log.c
index b512f12e805..a9969ad00a0 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -235,7 +235,7 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
* since the command-line takes precedent.
*/
if (use_default_decoration_filter &&
- !git_config_get_string("log.initialdecorationset", &value) &&
+ !repo_config_get_string(the_repository, "log.initialdecorationset", &value) &&
!strcmp("all", value))
use_default_decoration_filter = 0;
free(value);
diff --git a/builtin/notes.c b/builtin/notes.c
index 17004cdb10e..d2252cf5346 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -873,7 +873,7 @@ static int git_config_get_notes_strategy(const char *key,
{
char *value;
- if (git_config_get_string(key, &value))
+ if (repo_config_get_string(the_repository, key, &value))
return 1;
if (parse_notes_merge_strategy(value, strategy))
git_die_config(the_repository, key, _("unknown notes merge strategy %s"), value);
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 6bcc741a6ac..18aa69f0cae 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -53,7 +53,7 @@ static char *resolve_relative_url(const char *rel_url, const char *up_path, int
struct strbuf remotesb = STRBUF_INIT;
strbuf_addf(&remotesb, "remote.%s.url", remote);
- if (git_config_get_string(remotesb.buf, &remoteurl)) {
+ if (repo_config_get_string(the_repository, remotesb.buf, &remoteurl)) {
if (!quiet)
warning(_("could not look up configuration '%s'. "
"Assuming this repository is its own "
@@ -468,7 +468,7 @@ static void init_submodule(const char *path, const char *prefix,
* .gitmodules, so look it up directly.
*/
strbuf_addf(&sb, "submodule.%s.url", sub->name);
- if (git_config_get_string(sb.buf, &url)) {
+ if (repo_config_get_string(the_repository, sb.buf, &url)) {
if (!sub->url)
die(_("No url found for submodule path '%s' in .gitmodules"),
displaypath);
@@ -1623,11 +1623,11 @@ static void prepare_possible_alternates(const char *sm_name,
char *sm_alternate = NULL, *error_strategy = NULL;
struct submodule_alternate_setup sas = SUBMODULE_ALTERNATE_SETUP_INIT;
- git_config_get_string("submodule.alternateLocation", &sm_alternate);
+ repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate);
if (!sm_alternate)
return;
- git_config_get_string("submodule.alternateErrorStrategy", &error_strategy);
+ repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy);
if (!error_strategy)
error_strategy = xstrdup("die");
@@ -1808,11 +1808,11 @@ static int clone_submodule(const struct module_clone_data *clone_data,
die(_("could not get submodule directory for '%s'"), clone_data_path);
/* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */
- git_config_get_string("submodule.alternateLocation", &sm_alternate);
+ repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate);
if (sm_alternate)
git_config_set_in_file(p, "submodule.alternateLocation",
sm_alternate);
- git_config_get_string("submodule.alternateErrorStrategy", &error_strategy);
+ repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy);
if (error_strategy)
git_config_set_in_file(p, "submodule.alternateErrorStrategy",
error_strategy);
diff --git a/config.h b/config.h
index f6635e48c23..8887ebf62ea 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_string(const char *key, char **dest)
-{
- return repo_config_get_string(the_repository, key, dest);
-}
-
static inline int git_config_get_string_tmp(const char *key, const char **dest)
{
return repo_config_get_string_tmp(the_repository, key, dest);
diff --git a/fetch-pack.c b/fetch-pack.c
index 11344206f73..04768087879 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1910,7 +1910,7 @@ static void fetch_pack_config(void)
if (!uri_protocols.nr) {
char *str;
- if (!git_config_get_string("fetch.uriprotocols", &str) && str) {
+ if (!repo_config_get_string(the_repository, "fetch.uriprotocols", &str) && str) {
string_list_split(&uri_protocols, str, ',', -1);
free(str);
}
diff --git a/merge-ort.c b/merge-ort.c
index 49aa37a8f23..29789579c9b 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -5358,15 +5358,15 @@ static void merge_recursive_config(struct merge_options *opt, int ui)
git_config_get_int("merge.renamelimit", &opt->rename_limit);
git_config_get_bool("merge.renormalize", &renormalize);
opt->renormalize = renormalize;
- if (!git_config_get_string("diff.renames", &value)) {
+ if (!repo_config_get_string(the_repository, "diff.renames", &value)) {
opt->detect_renames = git_config_rename("diff.renames", value);
free(value);
}
- if (!git_config_get_string("merge.renames", &value)) {
+ if (!repo_config_get_string(the_repository, "merge.renames", &value)) {
opt->detect_renames = git_config_rename("merge.renames", value);
free(value);
}
- if (!git_config_get_string("merge.directoryrenames", &value)) {
+ if (!repo_config_get_string(the_repository, "merge.directoryrenames", &value)) {
int boolval = git_parse_maybe_bool(value);
if (0 <= boolval) {
opt->detect_directory_renames = boolval ?
@@ -5379,7 +5379,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)
free(value);
}
if (ui) {
- if (!git_config_get_string("diff.algorithm", &value)) {
+ if (!repo_config_get_string(the_repository, "diff.algorithm", &value)) {
long diff_algorithm = parse_algorithm_value(value);
if (diff_algorithm < 0)
die(_("unknown value for config '%s': %s"), "diff.algorithm", value);
diff --git a/scalar.c b/scalar.c
index 2aaff5aa109..07f855c9913 100644
--- a/scalar.c
+++ b/scalar.c
@@ -101,7 +101,7 @@ static int set_scalar_config(const struct scalar_config *config, int reconfigure
int res;
if ((reconfigure && config->overwrite_on_reconfigure) ||
- git_config_get_string(config->key, &value)) {
+ repo_config_get_string(the_repository, config->key, &value)) {
trace2_data_string("scalar", the_repository, config->key, "created");
res = git_config_set_gently(config->key, config->value);
} else {
@@ -193,7 +193,7 @@ static int set_recommended_config(int reconfigure)
* The `log.excludeDecoration` setting is special because it allows
* for multiple values.
*/
- if (git_config_get_string("log.excludeDecoration", &value)) {
+ if (repo_config_get_string(the_repository, "log.excludeDecoration", &value)) {
trace2_data_string("scalar", the_repository,
"log.excludeDecoration", "created");
if (git_config_set_multivar_gently("log.excludeDecoration",
diff --git a/sequencer.c b/sequencer.c
index df207f33e07..f3bada39b40 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -6089,7 +6089,7 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,
revs.topo_order = 1;
revs.pretty_given = 1;
- git_config_get_string("rebase.instructionFormat", &format);
+ repo_config_get_string(the_repository, "rebase.instructionFormat", &format);
if (!format || !*format) {
free(format);
format = xstrdup("# %s");
diff --git a/transport.c b/transport.c
index a246afd09fa..89e6297ce22 100644
--- a/transport.c
+++ b/transport.c
@@ -54,14 +54,14 @@ static int transport_color_config(void)
return 0;
initialized = 1;
- if (!git_config_get_string(key, &value))
+ if (!repo_config_get_string(the_repository, key, &value))
transport_use_color = git_config_colorbool(key, value);
if (!want_color_stderr(transport_use_color))
return 0;
for (size_t i = 0; i < ARRAY_SIZE(keys); i++)
- if (!git_config_get_string(keys[i], &value)) {
+ if (!repo_config_get_string(the_repository, keys[i], &value)) {
if (!value)
return config_error_nonbool(keys[i]);
if (color_parse(value, transport_colors[i]) < 0)
@@ -1078,7 +1078,7 @@ static enum protocol_allow_config get_protocol_config(const char *type)
char *value;
/* first check the per-protocol config */
- if (!git_config_get_string(key, &value)) {
+ if (!repo_config_get_string(the_repository, key, &value)) {
enum protocol_allow_config ret =
parse_protocol_config(key, value);
free(key);
@@ -1088,7 +1088,7 @@ static enum protocol_allow_config get_protocol_config(const char *type)
free(key);
/* if defined, fallback to user-defined default for unknown protocols */
- if (!git_config_get_string("protocol.allow", &value)) {
+ if (!repo_config_get_string(the_repository, "protocol.allow", &value)) {
enum protocol_allow_config ret =
parse_protocol_config("protocol.allow", value);
free(value);
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 08/21] config: drop `git_config_get_string()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (6 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 07/21] config: drop `git_config_get_string()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 09/21] config: drop `git_config_get_int()` wrapper Patrick Steinhardt
` (13 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_string()`.
All callsites are adjusted so that they use
`repo_config_get_string(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/fetch.c | 2 +-
builtin/gc.c | 4 ++--
builtin/remote.c | 2 +-
builtin/submodule--helper.c | 4 ++--
checkout.c | 2 +-
config.h | 5 -----
connect.c | 4 ++--
editor.c | 2 +-
help.c | 2 +-
promisor-remote.c | 4 ++--
protocol.c | 2 +-
remote.c | 2 +-
sideband.c | 6 +++---
t/helper/test-config.c | 2 +-
14 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index ea447c453d1..52eae4b972d 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -2508,7 +2508,7 @@ int cmd_fetch(int argc,
if (!max_jobs)
max_jobs = online_cpus();
- if (!git_config_get_string_tmp("fetch.bundleuri", &bundle_uri) &&
+ if (!repo_config_get_string_tmp(the_repository, "fetch.bundleuri", &bundle_uri) &&
fetch_bundle_uri(the_repository, bundle_uri, NULL))
warning(_("failed to fetch bundles from '%s'"), bundle_uri);
diff --git a/builtin/gc.c b/builtin/gc.c
index d8f7a1858cb..a2b8fbc9f3d 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1765,7 +1765,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,
if (opts->schedule) {
strategy = none_strategy;
- if (!git_config_get_string_tmp("maintenance.strategy", &config_str)) {
+ if (!repo_config_get_string_tmp(the_repository, "maintenance.strategy", &config_str)) {
if (!strcasecmp(config_str, "incremental"))
strategy = incremental_strategy;
}
@@ -1788,7 +1788,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,
strbuf_reset(&config_name);
strbuf_addf(&config_name, "maintenance.%s.schedule",
tasks[i].name);
- if (!git_config_get_string_tmp(config_name.buf, &config_str))
+ if (!repo_config_get_string_tmp(the_repository, config_name.buf, &config_str))
strategy.tasks[i].schedule = parse_schedule(config_str);
if (strategy.tasks[i].schedule < opts->schedule)
continue;
diff --git a/builtin/remote.c b/builtin/remote.c
index ebd70bea3a1..826b2dcfd04 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1268,7 +1268,7 @@ static int get_one_entry(struct remote *remote, void *priv)
strbuf_addf(&promisor_config, "remote.%s.partialclonefilter", remote->name);
strbuf_addf(&remote_info_buf, "%s (fetch)", remote->url.v[0]);
- if (!git_config_get_string_tmp(promisor_config.buf, &partial_clone_filter))
+ if (!repo_config_get_string_tmp(the_repository, promisor_config.buf, &partial_clone_filter))
strbuf_addf(&remote_info_buf, " [%s]", partial_clone_filter);
strbuf_release(&promisor_config);
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 18aa69f0cae..d2ab31835b5 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -496,7 +496,7 @@ static void init_submodule(const char *path, const char *prefix,
/* Copy "update" setting when it is not set yet */
strbuf_addf(&sb, "submodule.%s.update", sub->name);
- if (git_config_get_string_tmp(sb.buf, &upd) &&
+ if (repo_config_get_string_tmp(the_repository, sb.buf, &upd) &&
sub->update_strategy.type != SM_UPDATE_UNSPECIFIED) {
if (sub->update_strategy.type == SM_UPDATE_COMMAND) {
fprintf(stderr, _("warning: command update mode suggested for submodule '%s'\n"),
@@ -1034,7 +1034,7 @@ static void prepare_submodule_summary(struct summary_cb *info,
config_key = xstrfmt("submodule.%s.ignore",
sub->name);
- if (!git_config_get_string_tmp(config_key, &value))
+ if (!repo_config_get_string_tmp(the_repository, config_key, &value))
ignore_all = !strcmp(value, "all");
else if (sub->ignore)
ignore_all = !strcmp(sub->ignore, "all");
diff --git a/checkout.c b/checkout.c
index 0b1cf8b40b7..1588b116eed 100644
--- a/checkout.c
+++ b/checkout.c
@@ -52,7 +52,7 @@ char *unique_tracking_name(const char *name, struct object_id *oid,
{
struct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT;
const char *default_remote = NULL;
- if (!git_config_get_string_tmp("checkout.defaultremote", &default_remote))
+ if (!repo_config_get_string_tmp(the_repository, "checkout.defaultremote", &default_remote))
cb_data.default_remote = default_remote;
cb_data.src_ref = xstrfmt("refs/heads/%s", name);
cb_data.dst_oid = oid;
diff --git a/config.h b/config.h
index 8887ebf62ea..89739bee9b0 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_string_tmp(const char *key, const char **dest)
-{
- return repo_config_get_string_tmp(the_repository, key, dest);
-}
-
static inline int git_config_get_int(const char *key, int *dest)
{
return repo_config_get_int(the_repository, key, dest);
diff --git a/connect.c b/connect.c
index 4b1dc65e5ce..34cac24d54c 100644
--- a/connect.c
+++ b/connect.c
@@ -1154,7 +1154,7 @@ static const char *get_ssh_command(void)
if ((ssh = getenv("GIT_SSH_COMMAND")))
return ssh;
- if (!git_config_get_string_tmp("core.sshcommand", &ssh))
+ if (!repo_config_get_string_tmp(the_repository, "core.sshcommand", &ssh))
return ssh;
return NULL;
@@ -1173,7 +1173,7 @@ static void override_ssh_variant(enum ssh_variant *ssh_variant)
{
const char *variant = getenv("GIT_SSH_VARIANT");
- if (!variant && git_config_get_string_tmp("ssh.variant", &variant))
+ if (!variant && repo_config_get_string_tmp(the_repository, "ssh.variant", &variant))
return;
if (!strcmp(variant, "auto"))
diff --git a/editor.c b/editor.c
index b79d97b0e72..fd174e6a034 100644
--- a/editor.c
+++ b/editor.c
@@ -50,7 +50,7 @@ const char *git_sequence_editor(void)
const char *editor = getenv("GIT_SEQUENCE_EDITOR");
if (!editor)
- git_config_get_string_tmp("sequence.editor", &editor);
+ repo_config_get_string_tmp(the_repository, "sequence.editor", &editor);
if (!editor)
editor = git_editor();
diff --git a/help.c b/help.c
index db62cda4442..bb20498cfd0 100644
--- a/help.c
+++ b/help.c
@@ -417,7 +417,7 @@ void list_cmds_by_config(struct string_list *list)
{
const char *cmd_list;
- if (git_config_get_string_tmp("completion.commands", &cmd_list))
+ if (repo_config_get_string_tmp(the_repository, "completion.commands", &cmd_list))
return;
string_list_sort(list);
diff --git a/promisor-remote.c b/promisor-remote.c
index be6f82d12f8..a9c877d9cfa 100644
--- a/promisor-remote.c
+++ b/promisor-remote.c
@@ -327,7 +327,7 @@ static void promisor_info_vecs(struct repository *repo,
char *url_key = xstrfmt("remote.%s.url", r->name);
/* Only add remotes with a non empty URL */
- if (!git_config_get_string_tmp(url_key, &url) && *url) {
+ if (!repo_config_get_string_tmp(the_repository, url_key, &url) && *url) {
strvec_push(names, r->name);
strvec_push(urls, url);
}
@@ -433,7 +433,7 @@ static void filter_promisor_remote(struct repository *repo,
struct strvec names = STRVEC_INIT;
struct strvec urls = STRVEC_INIT;
- if (!git_config_get_string_tmp("promisor.acceptfromserver", &accept_str)) {
+ if (!repo_config_get_string_tmp(the_repository, "promisor.acceptfromserver", &accept_str)) {
if (!*accept_str || !strcasecmp("None", accept_str))
accept = ACCEPT_NONE;
else if (!strcasecmp("KnownUrl", accept_str))
diff --git a/protocol.c b/protocol.c
index bae7226ff40..65f66217021 100644
--- a/protocol.c
+++ b/protocol.c
@@ -24,7 +24,7 @@ enum protocol_version get_protocol_version_config(void)
const char *git_test_k = "GIT_TEST_PROTOCOL_VERSION";
const char *git_test_v;
- if (!git_config_get_string_tmp("protocol.version", &value)) {
+ if (!repo_config_get_string_tmp(the_repository, "protocol.version", &value)) {
enum protocol_version version = parse_protocol_version(value);
if (version == protocol_unknown_version)
diff --git a/remote.c b/remote.c
index e965f022f12..88f991795b2 100644
--- a/remote.c
+++ b/remote.c
@@ -734,7 +734,7 @@ static void validate_remote_url(struct remote *remote)
struct strbuf redacted = STRBUF_INIT;
int warn_not_die;
- if (git_config_get_string_tmp("transfer.credentialsinurl", &value))
+ if (repo_config_get_string_tmp(the_repository, "transfer.credentialsinurl", &value))
return;
if (!strcmp("warn", value))
diff --git a/sideband.c b/sideband.c
index 251e9615ed0..8f15b98a654 100644
--- a/sideband.c
+++ b/sideband.c
@@ -39,9 +39,9 @@ static int use_sideband_colors(void)
if (use_sideband_colors_cached >= 0)
return use_sideband_colors_cached;
- if (!git_config_get_string_tmp(key, &value))
+ if (!repo_config_get_string_tmp(the_repository, key, &value))
use_sideband_colors_cached = git_config_colorbool(key, value);
- else if (!git_config_get_string_tmp("color.ui", &value))
+ else if (!repo_config_get_string_tmp(the_repository, "color.ui", &value))
use_sideband_colors_cached = git_config_colorbool("color.ui", value);
else
use_sideband_colors_cached = GIT_COLOR_AUTO;
@@ -49,7 +49,7 @@ static int use_sideband_colors(void)
for (i = 0; i < ARRAY_SIZE(keywords); i++) {
strbuf_reset(&sb);
strbuf_addf(&sb, "%s.%s", key, keywords[i].keyword);
- if (git_config_get_string_tmp(sb.buf, &value))
+ if (repo_config_get_string_tmp(the_repository, sb.buf, &value))
continue;
color_parse(value, keywords[i].color);
}
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 1953ab846e4..30e70f1a6c2 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -171,7 +171,7 @@ int cmd__config(int argc, const char **argv)
goto exit1;
}
} else if (argc == 3 && !strcmp(argv[1], "get_string")) {
- if (!git_config_get_string_tmp(argv[2], &v)) {
+ if (!repo_config_get_string_tmp(the_repository, argv[2], &v)) {
printf("%s\n", v);
goto exit0;
} else {
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 09/21] config: drop `git_config_get_int()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (7 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 08/21] " Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 10/21] config: drop `git_config_get_ulong()` wrapper Patrick Steinhardt
` (12 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_int()`. All
callsites are adjusted so that they use
`repo_config_get_int(the_repository, ...)` instead. While some callsites
might already have a repository available, this mechanical conversion is
the exact same as the current situation and thus cannot cause any
regression. Those sites should eventually be cleaned up in a later patch
series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/credential-store.c | 2 +-
builtin/fast-import.c | 6 +++---
builtin/fetch.c | 4 ++--
builtin/gc.c | 26 +++++++++++++-------------
config.h | 5 -----
fetch-pack.c | 4 ++--
fsmonitor.c | 2 +-
merge-ort.c | 6 +++---
parallel-checkout.c | 4 ++--
refs.c | 2 +-
refs/packed-backend.c | 2 +-
sequencer.c | 2 +-
t/helper/test-config.c | 2 +-
13 files changed, 31 insertions(+), 36 deletions(-)
diff --git a/builtin/credential-store.c b/builtin/credential-store.c
index e669e99dbfb..b74e06cc93d 100644
--- a/builtin/credential-store.c
+++ b/builtin/credential-store.c
@@ -66,7 +66,7 @@ static void rewrite_credential_file(const char *fn, struct credential *c,
{
int timeout_ms = 1000;
- git_config_get_int("credentialstore.locktimeoutms", &timeout_ms);
+ repo_config_get_int(the_repository, "credentialstore.locktimeoutms", &timeout_ms);
if (hold_lock_file_for_update_timeout(&credential_lock, fn, 0, timeout_ms) < 0)
die_errno(_("unable to get credential storage lock in %d ms"), timeout_ms);
if (extra)
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 607441e921b..9b0ae437148 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -3527,7 +3527,7 @@ static void git_pack_config(void)
if (max_depth > MAX_DEPTH)
max_depth = MAX_DEPTH;
}
- if (!git_config_get_int("pack.indexversion", &indexversion_value)) {
+ if (!repo_config_get_int(the_repository, "pack.indexversion", &indexversion_value)) {
pack_idx_opts.version = indexversion_value;
if (pack_idx_opts.version > 2)
git_die_config(the_repository, "pack.indexversion",
@@ -3536,9 +3536,9 @@ static void git_pack_config(void)
if (!git_config_get_ulong("pack.packsizelimit", &packsizelimit_value))
max_packsize = packsizelimit_value;
- if (!git_config_get_int("fastimport.unpacklimit", &limit))
+ if (!repo_config_get_int(the_repository, "fastimport.unpacklimit", &limit))
unpack_limit = limit;
- else if (!git_config_get_int("transfer.unpacklimit", &limit))
+ else if (!repo_config_get_int(the_repository, "transfer.unpacklimit", &limit))
unpack_limit = limit;
repo_config(the_repository, git_default_config, NULL);
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 52eae4b972d..24645c46533 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -2683,12 +2683,12 @@ int cmd_fetch(int argc,
* but respect config settings disabling it.
*/
int opt_val;
- if (git_config_get_int("gc.autopacklimit", &opt_val))
+ if (repo_config_get_int(the_repository, "gc.autopacklimit", &opt_val))
opt_val = -1;
if (opt_val != 0)
git_config_push_parameter("gc.autoPackLimit=1");
- if (git_config_get_int("maintenance.incremental-repack.auto", &opt_val))
+ if (repo_config_get_int(the_repository, "maintenance.incremental-repack.auto", &opt_val))
opt_val = -1;
if (opt_val != 0)
git_config_push_parameter("maintenance.incremental-repack.auto=-1");
diff --git a/builtin/gc.c b/builtin/gc.c
index a2b8fbc9f3d..cf175b8f1b7 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -189,10 +189,10 @@ static void gc_config(struct gc_config *cfg)
gc_config_is_timestamp_never("gc.reflogexpireunreachable"))
cfg->prune_reflogs = 0;
- git_config_get_int("gc.aggressivewindow", &cfg->aggressive_window);
- git_config_get_int("gc.aggressivedepth", &cfg->aggressive_depth);
- git_config_get_int("gc.auto", &cfg->gc_auto_threshold);
- git_config_get_int("gc.autopacklimit", &cfg->gc_auto_pack_limit);
+ repo_config_get_int(the_repository, "gc.aggressivewindow", &cfg->aggressive_window);
+ repo_config_get_int(the_repository, "gc.aggressivedepth", &cfg->aggressive_depth);
+ repo_config_get_int(the_repository, "gc.auto", &cfg->gc_auto_threshold);
+ repo_config_get_int(the_repository, "gc.autopacklimit", &cfg->gc_auto_pack_limit);
git_config_get_bool("gc.autodetach", &cfg->detach_auto);
git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs);
git_config_get_ulong("gc.maxcruftsize", &cfg->max_cruft_size);
@@ -332,7 +332,7 @@ static int reflog_expire_condition(struct gc_config *cfg UNUSED)
};
int limit = 100;
- git_config_get_int("maintenance.reflog-expire.auto", &limit);
+ repo_config_get_int(the_repository, "maintenance.reflog-expire.auto", &limit);
if (!limit)
return 0;
if (limit < 0)
@@ -378,7 +378,7 @@ static int worktree_prune_condition(struct gc_config *cfg)
struct dirent *d;
DIR *dir = NULL;
- git_config_get_int("maintenance.worktree-prune.auto", &limit);
+ repo_config_get_int(the_repository, "maintenance.worktree-prune.auto", &limit);
if (limit <= 0) {
should_prune = limit < 0;
goto out;
@@ -423,7 +423,7 @@ static int rerere_gc_condition(struct gc_config *cfg UNUSED)
int should_gc = 0, limit = 1;
DIR *dir = NULL;
- git_config_get_int("maintenance.rerere-gc.auto", &limit);
+ repo_config_get_int(the_repository, "maintenance.rerere-gc.auto", &limit);
if (limit <= 0) {
should_gc = limit < 0;
goto out;
@@ -1161,8 +1161,8 @@ static int should_write_commit_graph(struct gc_config *cfg UNUSED)
data.num_not_in_graph = 0;
data.limit = 100;
- git_config_get_int("maintenance.commit-graph.auto",
- &data.limit);
+ repo_config_get_int(the_repository, "maintenance.commit-graph.auto",
+ &data.limit);
if (!data.limit)
return 0;
@@ -1300,8 +1300,8 @@ static int loose_object_auto_condition(struct gc_config *cfg UNUSED)
{
int count = 0;
- git_config_get_int("maintenance.loose-objects.auto",
- &loose_object_auto_limit);
+ repo_config_get_int(the_repository, "maintenance.loose-objects.auto",
+ &loose_object_auto_limit);
if (!loose_object_auto_limit)
return 0;
@@ -1415,8 +1415,8 @@ static int incremental_repack_auto_condition(struct gc_config *cfg UNUSED)
if (!the_repository->settings.core_multi_pack_index)
return 0;
- git_config_get_int("maintenance.incremental-repack.auto",
- &incremental_repack_auto_limit);
+ repo_config_get_int(the_repository, "maintenance.incremental-repack.auto",
+ &incremental_repack_auto_limit);
if (!incremental_repack_auto_limit)
return 0;
diff --git a/config.h b/config.h
index 89739bee9b0..2490c47daaf 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_int(const char *key, int *dest)
-{
- return repo_config_get_int(the_repository, key, dest);
-}
-
static inline int git_config_get_ulong(const char *key, unsigned long *dest)
{
return repo_config_get_ulong(the_repository, key, dest);
diff --git a/fetch-pack.c b/fetch-pack.c
index 04768087879..1f184efb3c9 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1901,8 +1901,8 @@ static int fetch_pack_config_cb(const char *var, const char *value,
static void fetch_pack_config(void)
{
- git_config_get_int("fetch.unpacklimit", &fetch_unpack_limit);
- git_config_get_int("transfer.unpacklimit", &transfer_unpack_limit);
+ repo_config_get_int(the_repository, "fetch.unpacklimit", &fetch_unpack_limit);
+ repo_config_get_int(the_repository, "transfer.unpacklimit", &transfer_unpack_limit);
git_config_get_bool("repack.usedeltabaseoffset", &prefer_ofs_delta);
git_config_get_bool("fetch.fsckobjects", &fetch_fsck_objects);
git_config_get_bool("transfer.fsckobjects", &transfer_fsck_objects);
diff --git a/fsmonitor.c b/fsmonitor.c
index 98b2b476f08..d07dc18967a 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -43,7 +43,7 @@ static int fsmonitor_hook_version(void)
{
int hook_version;
- if (git_config_get_int("core.fsmonitorhookversion", &hook_version))
+ if (repo_config_get_int(the_repository, "core.fsmonitorhookversion", &hook_version))
return -1;
if (hook_version == HOOK_INTERFACE_VERSION1 ||
diff --git a/merge-ort.c b/merge-ort.c
index 29789579c9b..45fd41f8dfd 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -5353,9 +5353,9 @@ static void merge_recursive_config(struct merge_options *opt, int ui)
{
char *value = NULL;
int renormalize = 0;
- git_config_get_int("merge.verbosity", &opt->verbosity);
- git_config_get_int("diff.renamelimit", &opt->rename_limit);
- git_config_get_int("merge.renamelimit", &opt->rename_limit);
+ repo_config_get_int(the_repository, "merge.verbosity", &opt->verbosity);
+ repo_config_get_int(the_repository, "diff.renamelimit", &opt->rename_limit);
+ repo_config_get_int(the_repository, "merge.renamelimit", &opt->rename_limit);
git_config_get_bool("merge.renormalize", &renormalize);
opt->renormalize = renormalize;
if (!repo_config_get_string(the_repository, "diff.renames", &value)) {
diff --git a/parallel-checkout.c b/parallel-checkout.c
index 57c2dcaa8f6..fba6aa65a6e 100644
--- a/parallel-checkout.c
+++ b/parallel-checkout.c
@@ -57,12 +57,12 @@ void get_parallel_checkout_configs(int *num_workers, int *threshold)
return;
}
- if (git_config_get_int("checkout.workers", num_workers))
+ if (repo_config_get_int(the_repository, "checkout.workers", num_workers))
*num_workers = DEFAULT_NUM_WORKERS;
else if (*num_workers < 1)
*num_workers = online_cpus();
- if (git_config_get_int("checkout.thresholdForParallelism", threshold))
+ if (repo_config_get_int(the_repository, "checkout.thresholdForParallelism", threshold))
*threshold = DEFAULT_THRESHOLD_FOR_PARALLELISM;
}
diff --git a/refs.c b/refs.c
index 73913b6627b..777cbd34ebc 100644
--- a/refs.c
+++ b/refs.c
@@ -945,7 +945,7 @@ long get_files_ref_lock_timeout_ms(void)
static int timeout_ms = 100;
if (!configured) {
- git_config_get_int("core.filesreflocktimeout", &timeout_ms);
+ repo_config_get_int(the_repository, "core.filesreflocktimeout", &timeout_ms);
configured = 1;
}
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index 7fd73a0e6da..7dd26726b1e 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -1228,7 +1228,7 @@ int packed_refs_lock(struct ref_store *ref_store, int flags, struct strbuf *err)
static int timeout_value = 1000;
if (!timeout_configured) {
- git_config_get_int("core.packedrefstimeout", &timeout_value);
+ repo_config_get_int(the_repository, "core.packedrefstimeout", &timeout_value);
timeout_configured = 1;
}
diff --git a/sequencer.c b/sequencer.c
index f3bada39b40..f8d9bb69df8 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -5834,7 +5834,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,
*cmd_reset = abbr ? "t" : "reset",
*cmd_merge = abbr ? "m" : "merge";
- git_config_get_int("rebase.maxlabellength", &state.max_label_length);
+ repo_config_get_int(the_repository, "rebase.maxlabellength", &state.max_label_length);
oidmap_init(&commit2todo, 0);
oidmap_init(&state.commit2label, 0);
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 30e70f1a6c2..ce1e3330516 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -155,7 +155,7 @@ int cmd__config(int argc, const char **argv)
BUG("Key \"%s\" has unknown return %d", argv[2], ret);
goto exit1;
} else if (argc == 3 && !strcmp(argv[1], "get_int")) {
- if (!git_config_get_int(argv[2], &val)) {
+ if (!repo_config_get_int(the_repository, argv[2], &val)) {
printf("%d\n", val);
goto exit0;
} else {
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 10/21] config: drop `git_config_get_ulong()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (8 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 09/21] config: drop `git_config_get_int()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 11/21] config: drop `git_config_get_bool()` wrapper Patrick Steinhardt
` (11 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_ulong()`. All
callsites are adjusted so that they use
`repo_config_get_ulong(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/fast-import.c | 4 ++--
builtin/gc.c | 10 +++++-----
config.h | 5 -----
http-backend.c | 2 +-
4 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 9b0ae437148..a3f7f14f4fe 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -3523,7 +3523,7 @@ static void git_pack_config(void)
int limit;
unsigned long packsizelimit_value;
- if (!git_config_get_ulong("pack.depth", &max_depth)) {
+ if (!repo_config_get_ulong(the_repository, "pack.depth", &max_depth)) {
if (max_depth > MAX_DEPTH)
max_depth = MAX_DEPTH;
}
@@ -3533,7 +3533,7 @@ static void git_pack_config(void)
git_die_config(the_repository, "pack.indexversion",
"bad pack.indexVersion=%"PRIu32, pack_idx_opts.version);
}
- if (!git_config_get_ulong("pack.packsizelimit", &packsizelimit_value))
+ if (!repo_config_get_ulong(the_repository, "pack.packsizelimit", &packsizelimit_value))
max_packsize = packsizelimit_value;
if (!repo_config_get_int(the_repository, "fastimport.unpacklimit", &limit))
diff --git a/builtin/gc.c b/builtin/gc.c
index cf175b8f1b7..d15daf59625 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -195,7 +195,7 @@ static void gc_config(struct gc_config *cfg)
repo_config_get_int(the_repository, "gc.autopacklimit", &cfg->gc_auto_pack_limit);
git_config_get_bool("gc.autodetach", &cfg->detach_auto);
git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs);
- git_config_get_ulong("gc.maxcruftsize", &cfg->max_cruft_size);
+ repo_config_get_ulong(the_repository, "gc.maxcruftsize", &cfg->max_cruft_size);
if (!repo_config_get_expiry(the_repository, "gc.pruneexpire", &owned)) {
free(cfg->prune_expire);
@@ -212,10 +212,10 @@ static void gc_config(struct gc_config *cfg)
cfg->gc_log_expire = owned;
}
- git_config_get_ulong("gc.bigpackthreshold", &cfg->big_pack_threshold);
- git_config_get_ulong("pack.deltacachesize", &cfg->max_delta_cache_size);
+ repo_config_get_ulong(the_repository, "gc.bigpackthreshold", &cfg->big_pack_threshold);
+ repo_config_get_ulong(the_repository, "pack.deltacachesize", &cfg->max_delta_cache_size);
- if (!git_config_get_ulong("core.deltabasecachelimit", &ulongval))
+ if (!repo_config_get_ulong(the_repository, "core.deltabasecachelimit", &ulongval))
cfg->delta_base_cache_limit = ulongval;
if (!repo_config_get_string(the_repository, "gc.repackfilter", &owned)) {
@@ -2344,7 +2344,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
die(_("failed to create directories for '%s'"), filename);
if ((long)lock_file_timeout_ms < 0 &&
- git_config_get_ulong("gc.launchctlplistlocktimeoutms",
+ repo_config_get_ulong(the_repository, "gc.launchctlplistlocktimeoutms",
&lock_file_timeout_ms))
lock_file_timeout_ms = 150;
diff --git a/config.h b/config.h
index 2490c47daaf..e22c07a4488 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_ulong(const char *key, unsigned long *dest)
-{
- return repo_config_get_ulong(the_repository, key, dest);
-}
-
static inline int git_config_get_bool(const char *key, int *dest)
{
return repo_config_get_bool(the_repository, key, dest);
diff --git a/http-backend.c b/http-backend.c
index ad8c4037493..3d5d5a84646 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -247,7 +247,7 @@ static void http_config(void)
struct strbuf var = STRBUF_INIT;
git_config_get_bool("http.getanyfile", &getanyfile);
- git_config_get_ulong("http.maxrequestbuffer", &max_request_buffer);
+ repo_config_get_ulong(the_repository, "http.maxrequestbuffer", &max_request_buffer);
for (i = 0; i < ARRAY_SIZE(rpc_service); i++) {
struct rpc_service *svc = &rpc_service[i];
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 11/21] config: drop `git_config_get_bool()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (9 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 10/21] config: drop `git_config_get_ulong()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 12/21] config: drop `git_config_set_in_file()` wrapper Patrick Steinhardt
` (10 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_bool()`. All
callsites are adjusted so that they use
`repo_config_get_bool(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
archive.c | 2 +-
builtin/am.c | 8 ++++----
builtin/checkout.c | 2 +-
builtin/clone.c | 2 +-
builtin/credential-cache--daemon.c | 2 +-
builtin/gc.c | 6 +++---
builtin/grep.c | 2 +-
builtin/rebase.c | 2 +-
compat/precompose_utf8.c | 2 +-
config.h | 5 -----
daemon.c | 2 +-
fetch-pack.c | 8 ++++----
http-backend.c | 4 ++--
merge-ort.c | 2 +-
promisor-remote.c | 4 ++--
read-cache.c | 4 ++--
rerere.c | 4 ++--
run-command.c | 6 +++---
setup.c | 2 +-
t/helper/test-config.c | 2 +-
transport.c | 2 +-
21 files changed, 34 insertions(+), 39 deletions(-)
diff --git a/archive.c b/archive.c
index 2dd306a07a7..310672b479a 100644
--- a/archive.c
+++ b/archive.c
@@ -760,7 +760,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
const char **argv_copy;
int rc;
- git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable);
+ repo_config_get_bool(the_repository, "uploadarchive.allowunreachable", &remote_allow_unreachable);
repo_config(the_repository, git_default_config, NULL);
describe_status.max_invocations = 1;
diff --git a/builtin/am.c b/builtin/am.c
index a7e7cf1465a..6073d64ae97 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -162,18 +162,18 @@ static void am_state_init(struct am_state *state)
state->prec = 4;
- git_config_get_bool("am.threeway", &state->threeway);
+ repo_config_get_bool(the_repository, "am.threeway", &state->threeway);
state->utf8 = 1;
- git_config_get_bool("am.messageid", &state->message_id);
+ repo_config_get_bool(the_repository, "am.messageid", &state->message_id);
state->scissors = SCISSORS_UNSET;
state->quoted_cr = quoted_cr_unset;
strvec_init(&state->git_apply_opts);
- if (!git_config_get_bool("commit.gpgsign", &gpgsign))
+ if (!repo_config_get_bool(the_repository, "commit.gpgsign", &gpgsign))
state->sign_commit = gpgsign ? "" : NULL;
}
@@ -965,7 +965,7 @@ static int split_mail(struct am_state *state, enum patch_format patch_format,
{
if (keep_cr < 0) {
keep_cr = 0;
- git_config_get_bool("am.keepcr", &keep_cr);
+ repo_config_get_bool(the_repository, "am.keepcr", &keep_cr);
}
switch (patch_format) {
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 948ff7bdda7..37efde59898 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -291,7 +291,7 @@ static int checkout_merged(int pos, const struct checkout *state,
read_mmblob(&ours, &threeway[1]);
read_mmblob(&theirs, &threeway[2]);
- git_config_get_bool("merge.renormalize", &renormalize);
+ repo_config_get_bool(the_repository, "merge.renormalize", &renormalize);
ll_opts.renormalize = renormalize;
ll_opts.conflict_style = conflict_style;
merge_status = ll_merge(&result_buf, path, &ancestor, "base",
diff --git a/builtin/clone.c b/builtin/clone.c
index 3c6d8529b6c..34eea11db4d 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -1150,7 +1150,7 @@ int cmd_clone(int argc,
strbuf_reset(&sb);
}
- if (!git_config_get_bool("submodule.stickyRecursiveClone", &val) &&
+ if (!repo_config_get_bool(the_repository, "submodule.stickyRecursiveClone", &val) &&
val)
string_list_append(&option_config, "submodule.recurse=true");
diff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c
index 5065ff4660b..65cc619bec2 100644
--- a/builtin/credential-cache--daemon.c
+++ b/builtin/credential-cache--daemon.c
@@ -307,7 +307,7 @@ int cmd_credential_cache_daemon(int argc,
OPT_END()
};
- git_config_get_bool("credentialcache.ignoresighup", &ignore_sighup);
+ repo_config_get_bool(the_repository, "credentialcache.ignoresighup", &ignore_sighup);
argc = parse_options(argc, argv, prefix, options, usage, 0);
socket_path = argv[0];
diff --git a/builtin/gc.c b/builtin/gc.c
index d15daf59625..fa62e4f2627 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -193,8 +193,8 @@ static void gc_config(struct gc_config *cfg)
repo_config_get_int(the_repository, "gc.aggressivedepth", &cfg->aggressive_depth);
repo_config_get_int(the_repository, "gc.auto", &cfg->gc_auto_threshold);
repo_config_get_int(the_repository, "gc.autopacklimit", &cfg->gc_auto_pack_limit);
- git_config_get_bool("gc.autodetach", &cfg->detach_auto);
- git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs);
+ repo_config_get_bool(the_repository, "gc.autodetach", &cfg->detach_auto);
+ repo_config_get_bool(the_repository, "gc.cruftpacks", &cfg->cruft_packs);
repo_config_get_ulong(the_repository, "gc.maxcruftsize", &cfg->max_cruft_size);
if (!repo_config_get_expiry(the_repository, "gc.pruneexpire", &owned)) {
@@ -1779,7 +1779,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,
strbuf_reset(&config_name);
strbuf_addf(&config_name, "maintenance.%s.enabled",
tasks[i].name);
- if (!git_config_get_bool(config_name.buf, &config_value))
+ if (!repo_config_get_bool(the_repository, config_name.buf, &config_value))
strategy.tasks[i].enabled = config_value;
if (!strategy.tasks[i].enabled)
continue;
diff --git a/builtin/grep.c b/builtin/grep.c
index 7982dda9a3b..8fcb69dbf2c 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -1058,7 +1058,7 @@ int cmd_grep(int argc,
if (use_index && !startup_info->have_repository) {
int fallback = 0;
- git_config_get_bool("grep.fallbacktonoindex", &fallback);
+ repo_config_get_bool(the_repository, "grep.fallbacktonoindex", &fallback);
if (fallback)
use_index = 0;
else
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 0c3daa4b814..72a52bdfb98 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -340,7 +340,7 @@ static int run_sequencer_rebase(struct rebase_options *opts)
unsigned flags = 0;
int abbreviate_commands = 0, ret = 0;
- git_config_get_bool("rebase.abbreviatecommands", &abbreviate_commands);
+ repo_config_get_bool(the_repository, "rebase.abbreviatecommands", &abbreviate_commands);
flags |= opts->keep_empty ? TODO_LIST_KEEP_EMPTY : 0;
flags |= abbreviate_commands ? TODO_LIST_ABBREVIATE_CMDS : 0;
diff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c
index 12e38e0ea3c..3985ed108eb 100644
--- a/compat/precompose_utf8.c
+++ b/compat/precompose_utf8.c
@@ -75,7 +75,7 @@ const char *precompose_string_if_needed(const char *in)
iconv_t ic_prec;
char *out;
if (precomposed_unicode < 0)
- git_config_get_bool("core.precomposeunicode", &precomposed_unicode);
+ repo_config_get_bool(the_repository, "core.precomposeunicode", &precomposed_unicode);
if (precomposed_unicode != 1)
return in;
ic_prec = iconv_open(repo_encoding, path_encoding);
diff --git a/config.h b/config.h
index e22c07a4488..c9f582c7c55 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_bool(const char *key, int *dest)
-{
- return repo_config_get_bool(the_repository, key, dest);
-}
-
static inline int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest)
{
return repo_config_get_bool_or_int(the_repository, key, is_bool, dest);
diff --git a/daemon.c b/daemon.c
index 61cd50f7200..cb209235557 100644
--- a/daemon.c
+++ b/daemon.c
@@ -402,7 +402,7 @@ static int run_service(const char *dir, struct daemon_service *service,
if (service->overridable) {
strbuf_addf(&var, "daemon.%s", service->config_name);
- git_config_get_bool(var.buf, &enabled);
+ repo_config_get_bool(the_repository, var.buf, &enabled);
strbuf_release(&var);
}
if (!enabled) {
diff --git a/fetch-pack.c b/fetch-pack.c
index 1f184efb3c9..94b1436c5c2 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1903,10 +1903,10 @@ static void fetch_pack_config(void)
{
repo_config_get_int(the_repository, "fetch.unpacklimit", &fetch_unpack_limit);
repo_config_get_int(the_repository, "transfer.unpacklimit", &transfer_unpack_limit);
- git_config_get_bool("repack.usedeltabaseoffset", &prefer_ofs_delta);
- git_config_get_bool("fetch.fsckobjects", &fetch_fsck_objects);
- git_config_get_bool("transfer.fsckobjects", &transfer_fsck_objects);
- git_config_get_bool("transfer.advertisesid", &advertise_sid);
+ repo_config_get_bool(the_repository, "repack.usedeltabaseoffset", &prefer_ofs_delta);
+ repo_config_get_bool(the_repository, "fetch.fsckobjects", &fetch_fsck_objects);
+ repo_config_get_bool(the_repository, "transfer.fsckobjects", &transfer_fsck_objects);
+ repo_config_get_bool(the_repository, "transfer.advertisesid", &advertise_sid);
if (!uri_protocols.nr) {
char *str;
diff --git a/http-backend.c b/http-backend.c
index 3d5d5a84646..d5dfe762bb5 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -246,13 +246,13 @@ static void http_config(void)
int i, value = 0;
struct strbuf var = STRBUF_INIT;
- git_config_get_bool("http.getanyfile", &getanyfile);
+ repo_config_get_bool(the_repository, "http.getanyfile", &getanyfile);
repo_config_get_ulong(the_repository, "http.maxrequestbuffer", &max_request_buffer);
for (i = 0; i < ARRAY_SIZE(rpc_service); i++) {
struct rpc_service *svc = &rpc_service[i];
strbuf_addf(&var, "http.%s", svc->config_name);
- if (!git_config_get_bool(var.buf, &value))
+ if (!repo_config_get_bool(the_repository, var.buf, &value))
svc->enabled = value;
strbuf_reset(&var);
}
diff --git a/merge-ort.c b/merge-ort.c
index 45fd41f8dfd..86896ff11b0 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -5356,7 +5356,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)
repo_config_get_int(the_repository, "merge.verbosity", &opt->verbosity);
repo_config_get_int(the_repository, "diff.renamelimit", &opt->rename_limit);
repo_config_get_int(the_repository, "merge.renamelimit", &opt->rename_limit);
- git_config_get_bool("merge.renormalize", &renormalize);
+ repo_config_get_bool(the_repository, "merge.renormalize", &renormalize);
opt->renormalize = renormalize;
if (!repo_config_get_string(the_repository, "diff.renames", &value)) {
opt->detect_renames = git_config_rename("diff.renames", value);
diff --git a/promisor-remote.c b/promisor-remote.c
index a9c877d9cfa..08b0da89622 100644
--- a/promisor-remote.c
+++ b/promisor-remote.c
@@ -46,7 +46,7 @@ static int fetch_objects(struct repository *repo,
"fetch", remote_name, "--no-tags",
"--no-write-fetch-head", "--recurse-submodules=no",
"--filter=blob:none", "--stdin", NULL);
- if (!git_config_get_bool("promisor.quiet", &quiet) && quiet)
+ if (!repo_config_get_bool(the_repository, "promisor.quiet", &quiet) && quiet)
strvec_push(&child.args, "--quiet");
if (start_command(&child))
die(_("promisor-remote: unable to fork off fetch subprocess"));
@@ -343,7 +343,7 @@ char *promisor_remote_info(struct repository *repo)
struct strvec names = STRVEC_INIT;
struct strvec urls = STRVEC_INIT;
- git_config_get_bool("promisor.advertise", &advertise_promisors);
+ repo_config_get_bool(the_repository, "promisor.advertise", &advertise_promisors);
if (!advertise_promisors)
return NULL;
diff --git a/read-cache.c b/read-cache.c
index 5cf41b81f1f..4fdde758d1b 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2755,7 +2755,7 @@ static int record_eoie(void)
{
int val;
- if (!git_config_get_bool("index.recordendofindexentries", &val))
+ if (!repo_config_get_bool(the_repository, "index.recordendofindexentries", &val))
return val;
/*
@@ -2770,7 +2770,7 @@ static int record_ieot(void)
{
int val;
- if (!git_config_get_bool("index.recordoffsettable", &val))
+ if (!repo_config_get_bool(the_repository, "index.recordoffsettable", &val))
return val;
/*
diff --git a/rerere.c b/rerere.c
index 1ac2075144c..c7c3e535ce5 100644
--- a/rerere.c
+++ b/rerere.c
@@ -877,8 +877,8 @@ static int do_plain_rerere(struct repository *r,
static void git_rerere_config(void)
{
- git_config_get_bool("rerere.enabled", &rerere_enabled);
- git_config_get_bool("rerere.autoupdate", &rerere_autoupdate);
+ repo_config_get_bool(the_repository, "rerere.enabled", &rerere_enabled);
+ repo_config_get_bool(the_repository, "rerere.autoupdate", &rerere_autoupdate);
repo_config(the_repository, git_default_config, NULL);
}
diff --git a/run-command.c b/run-command.c
index 8833b233678..ed9575bd6a8 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1817,7 +1817,7 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint)
{
int enabled, auto_detach;
- if (!git_config_get_bool("maintenance.auto", &enabled) &&
+ if (!repo_config_get_bool(the_repository, "maintenance.auto", &enabled) &&
!enabled)
return 0;
@@ -1826,8 +1826,8 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint)
* honoring `gc.autoDetach`. This is somewhat weird, but required to
* retain behaviour from when we used to run git-gc(1) here.
*/
- if (git_config_get_bool("maintenance.autodetach", &auto_detach) &&
- git_config_get_bool("gc.autodetach", &auto_detach))
+ if (repo_config_get_bool(the_repository, "maintenance.autodetach", &auto_detach) &&
+ repo_config_get_bool(the_repository, "gc.autodetach", &auto_detach))
auto_detach = 1;
maint->git_cmd = 1;
diff --git a/setup.c b/setup.c
index 9661c5d5d5d..a06bb921b3a 100644
--- a/setup.c
+++ b/setup.c
@@ -1877,7 +1877,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
* the core.precomposeunicode configuration, this
* has to happen after the above block that finds
* out where the repository is, i.e. a preparation
- * for calling git_config_get_bool().
+ * for calling repo_config_get_bool().
*/
if (prefix) {
prefix = precompose_string_if_needed(prefix);
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index ce1e3330516..9f8cca7c48c 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -163,7 +163,7 @@ int cmd__config(int argc, const char **argv)
goto exit1;
}
} else if (argc == 3 && !strcmp(argv[1], "get_bool")) {
- if (!git_config_get_bool(argv[2], &val)) {
+ if (!repo_config_get_bool(the_repository, argv[2], &val)) {
printf("%d\n", val);
goto exit0;
} else {
diff --git a/transport.c b/transport.c
index 89e6297ce22..e305d6bd228 100644
--- a/transport.c
+++ b/transport.c
@@ -1602,7 +1602,7 @@ int transport_get_remote_bundle_uri(struct transport *transport)
* Don't request bundle-uri from the server unless configured to
* do so by the transfer.bundleURI=true config option.
*/
- if (git_config_get_bool("transfer.bundleuri", &value) || !value)
+ if (repo_config_get_bool(the_repository, "transfer.bundleuri", &value) || !value)
return 0;
if (!transport->bundles->baseURI)
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 12/21] config: drop `git_config_set_in_file()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (10 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 11/21] config: drop `git_config_get_bool()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 13/21] config: drop `git_config_set_gently()` wrapper Patrick Steinhardt
` (9 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_set_in_file()`.
All callsites are adjusted so that they use
`repo_config_set_in_file(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/submodule--helper.c | 10 +++++-----
config.h | 6 ------
dir.c | 4 ++--
3 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index d2ab31835b5..0be737ac4ff 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1810,12 +1810,12 @@ static int clone_submodule(const struct module_clone_data *clone_data,
/* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */
repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate);
if (sm_alternate)
- git_config_set_in_file(p, "submodule.alternateLocation",
- sm_alternate);
+ repo_config_set_in_file(the_repository, p, "submodule.alternateLocation",
+ sm_alternate);
repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy);
if (error_strategy)
- git_config_set_in_file(p, "submodule.alternateErrorStrategy",
- error_strategy);
+ repo_config_set_in_file(the_repository, p, "submodule.alternateErrorStrategy",
+ error_strategy);
free(sm_alternate);
free(error_strategy);
@@ -2522,7 +2522,7 @@ static int ensure_core_worktree(const char *path)
abs_path = absolute_pathdup(path);
rel_path = relative_path(abs_path, subrepo.gitdir, &sb);
- git_config_set_in_file(cfg_file, "core.worktree", rel_path);
+ repo_config_set_in_file(the_repository, cfg_file, "core.worktree", rel_path);
free(cfg_file);
free(abs_path);
diff --git a/config.h b/config.h
index c9f582c7c55..b4f79d4d4cc 100644
--- a/config.h
+++ b/config.h
@@ -734,12 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)
return repo_config_get_pathname(the_repository, key, dest);
}
-static inline void git_config_set_in_file(const char *config_filename,
- const char *key, const char *value)
-{
- repo_config_set_in_file(the_repository, config_filename, key, value);
-}
-
static inline int git_config_set_gently(const char *key, const char *value)
{
return repo_config_set_gently(the_repository, key, value);
diff --git a/dir.c b/dir.c
index 02873f59ea6..dfb4d40103f 100644
--- a/dir.c
+++ b/dir.c
@@ -4091,8 +4091,8 @@ void connect_work_tree_and_git_dir(const char *work_tree_,
write_file(gitfile_sb.buf, "gitdir: %s",
relative_path(git_dir, work_tree, &rel_path));
/* Update core.worktree setting */
- git_config_set_in_file(cfg_sb.buf, "core.worktree",
- relative_path(work_tree, git_dir, &rel_path));
+ repo_config_set_in_file(the_repository, cfg_sb.buf, "core.worktree",
+ relative_path(work_tree, git_dir, &rel_path));
strbuf_release(&gitfile_sb);
strbuf_release(&cfg_sb);
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 13/21] config: drop `git_config_set_gently()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (11 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 12/21] config: drop `git_config_set_in_file()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 14/21] config: drop `git_config_set()` wrapper Patrick Steinhardt
` (8 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_set_gently()`.
All callsites are adjusted so that they use
`repo_config_set_gently(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
branch.c | 6 +++---
builtin/clone.c | 2 +-
builtin/remote.c | 8 ++++----
builtin/submodule--helper.c | 14 +++++++-------
config.h | 5 -----
scalar.c | 4 ++--
setup.c | 4 ++--
worktree.c | 4 ++--
8 files changed, 21 insertions(+), 26 deletions(-)
diff --git a/branch.c b/branch.c
index b4811671fc7..3dc237adf6c 100644
--- a/branch.c
+++ b/branch.c
@@ -116,7 +116,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
}
strbuf_addf(&key, "branch.%s.remote", local);
- if (git_config_set_gently(key.buf, origin ? origin : ".") < 0)
+ if (repo_config_set_gently(the_repository, key.buf, origin ? origin : ".") < 0)
goto out_err;
strbuf_reset(&key);
@@ -127,7 +127,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
* more than one is provided, use CONFIG_REGEX_NONE to preserve what
* we've written so far.
*/
- if (git_config_set_gently(key.buf, NULL) < 0)
+ if (repo_config_set_gently(the_repository, key.buf, NULL) < 0)
goto out_err;
for_each_string_list_item(item, remotes)
if (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
@@ -136,7 +136,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
if (rebasing) {
strbuf_reset(&key);
strbuf_addf(&key, "branch.%s.rebase", local);
- if (git_config_set_gently(key.buf, "true") < 0)
+ if (repo_config_set_gently(the_repository, key.buf, "true") < 0)
goto out_err;
}
strbuf_release(&key);
diff --git a/builtin/clone.c b/builtin/clone.c
index 34eea11db4d..0d7dd5e8ec9 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -1467,7 +1467,7 @@ int cmd_clone(int argc,
warning(_("failed to fetch objects from bundle URI '%s'"),
bundle_uri);
else if (has_heuristic)
- git_config_set_gently("fetch.bundleuri", bundle_uri);
+ repo_config_set_gently(the_repository, "fetch.bundleuri", bundle_uri);
remote_state_clear(the_repository->remote_state);
free(the_repository->remote_state);
diff --git a/builtin/remote.c b/builtin/remote.c
index 826b2dcfd04..5c4dfc98afa 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -694,8 +694,8 @@ static void handle_push_default(const char* old_name, const char* new_name)
if (push_default.scope >= CONFIG_SCOPE_COMMAND)
; /* pass */
else if (push_default.scope >= CONFIG_SCOPE_LOCAL) {
- int result = git_config_set_gently("remote.pushDefault",
- new_name);
+ int result = repo_config_set_gently(the_repository, "remote.pushDefault",
+ new_name);
if (new_name && result && result != CONFIG_NOTHING_SET)
die(_("could not set '%s'"), "remote.pushDefault");
else if (!new_name && result && result != CONFIG_NOTHING_SET)
@@ -934,7 +934,7 @@ static int rm(int argc, const char **argv, const char *prefix,
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.%s",
item->string, *k);
- result = git_config_set_gently(buf.buf, NULL);
+ result = repo_config_set_gently(the_repository, buf.buf, NULL);
if (result && result != CONFIG_NOTHING_SET)
die(_("could not unset '%s'"), buf.buf);
}
@@ -942,7 +942,7 @@ static int rm(int argc, const char **argv, const char *prefix,
if (info->push_remote_name && !strcmp(info->push_remote_name, remote->name)) {
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.pushremote", item->string);
- result = git_config_set_gently(buf.buf, NULL);
+ result = repo_config_set_gently(the_repository, buf.buf, NULL);
if (result && result != CONFIG_NOTHING_SET)
die(_("could not unset '%s'"), buf.buf);
}
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 0be737ac4ff..710a2a2004e 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -458,7 +458,7 @@ static void init_submodule(const char *path, const char *prefix,
*/
if (!is_submodule_active(the_repository, path)) {
strbuf_addf(&sb, "submodule.%s.active", sub->name);
- git_config_set_gently(sb.buf, "true");
+ repo_config_set_gently(the_repository, sb.buf, "true");
strbuf_reset(&sb);
}
@@ -484,7 +484,7 @@ static void init_submodule(const char *path, const char *prefix,
free(oldurl);
}
- if (git_config_set_gently(sb.buf, url))
+ if (repo_config_set_gently(the_repository, sb.buf, url))
die(_("Failed to register url for submodule path '%s'"),
displaypath);
if (!(flags & OPT_QUIET))
@@ -506,7 +506,7 @@ static void init_submodule(const char *path, const char *prefix,
upd = submodule_update_type_to_string(sub->update_strategy.type);
}
- if (git_config_set_gently(sb.buf, upd))
+ if (repo_config_set_gently(the_repository, sb.buf, upd))
die(_("Failed to register update mode for submodule path '%s'"), displaypath);
}
strbuf_release(&sb);
@@ -1262,7 +1262,7 @@ static void sync_submodule(const char *path, const char *prefix,
strbuf_reset(&sb);
strbuf_addf(&sb, "submodule.%s.url", sub->name);
- if (git_config_set_gently(sb.buf, super_config_url))
+ if (repo_config_set_gently(the_repository, sb.buf, super_config_url))
die(_("failed to register url for submodule path '%s'"),
displaypath);
@@ -3309,7 +3309,7 @@ static void configure_added_submodule(struct add_data *add_data)
struct child_process add_gitmodules = CHILD_PROCESS_INIT;
key = xstrfmt("submodule.%s.url", add_data->sm_name);
- git_config_set_gently(key, add_data->realrepo);
+ repo_config_set_gently(the_repository, key, add_data->realrepo);
free(key);
add_submod.git_cmd = 1;
@@ -3356,12 +3356,12 @@ static void configure_added_submodule(struct add_data *add_data)
*/
if (!is_submodule_active(the_repository, add_data->sm_path)) {
key = xstrfmt("submodule.%s.active", add_data->sm_name);
- git_config_set_gently(key, "true");
+ repo_config_set_gently(the_repository, key, "true");
free(key);
}
} else {
key = xstrfmt("submodule.%s.active", add_data->sm_name);
- git_config_set_gently(key, "true");
+ repo_config_set_gently(the_repository, key, "true");
free(key);
}
}
diff --git a/config.h b/config.h
index b4f79d4d4cc..90977441c3b 100644
--- a/config.h
+++ b/config.h
@@ -734,11 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)
return repo_config_get_pathname(the_repository, key, dest);
}
-static inline int git_config_set_gently(const char *key, const char *value)
-{
- return repo_config_set_gently(the_repository, key, value);
-}
-
static inline void git_config_set(const char *key, const char *value)
{
repo_config_set(the_repository, key, value);
diff --git a/scalar.c b/scalar.c
index 07f855c9913..c09c5ca194e 100644
--- a/scalar.c
+++ b/scalar.c
@@ -103,7 +103,7 @@ static int set_scalar_config(const struct scalar_config *config, int reconfigure
if ((reconfigure && config->overwrite_on_reconfigure) ||
repo_config_get_string(the_repository, config->key, &value)) {
trace2_data_string("scalar", the_repository, config->key, "created");
- res = git_config_set_gently(config->key, config->value);
+ res = repo_config_set_gently(the_repository, config->key, config->value);
} else {
trace2_data_string("scalar", the_repository, config->key, "exists");
res = 0;
@@ -322,7 +322,7 @@ static int set_config(const char *fmt, ...)
value = strchr(buf.buf, '=');
if (value)
*(value++) = '\0';
- res = git_config_set_gently(buf.buf, value);
+ res = repo_config_set_gently(the_repository, buf.buf, value);
strbuf_release(&buf);
return res;
diff --git a/setup.c b/setup.c
index a06bb921b3a..a05c348dcdf 100644
--- a/setup.c
+++ b/setup.c
@@ -2236,13 +2236,13 @@ void initialize_repository_version(int hash_algo,
git_config_set("extensions.objectformat",
hash_algos[hash_algo].name);
else if (reinit)
- git_config_set_gently("extensions.objectformat", NULL);
+ repo_config_set_gently(the_repository, "extensions.objectformat", NULL);
if (ref_storage_format != REF_STORAGE_FORMAT_FILES)
git_config_set("extensions.refstorage",
ref_storage_format_to_name(ref_storage_format));
else if (reinit)
- git_config_set_gently("extensions.refstorage", NULL);
+ repo_config_set_gently(the_repository, "extensions.refstorage", NULL);
if (reinit) {
struct strbuf config = STRBUF_INIT;
diff --git a/worktree.c b/worktree.c
index c34b9eb74e5..981a2713374 100644
--- a/worktree.c
+++ b/worktree.c
@@ -1013,7 +1013,7 @@ int init_worktree_config(struct repository *r)
*/
if (r->repository_format_worktree_config)
return 0;
- if ((res = git_config_set_gently("extensions.worktreeConfig", "true")))
+ if ((res = repo_config_set_gently(the_repository, "extensions.worktreeConfig", "true")))
return error(_("failed to set extensions.worktreeConfig setting"));
common_config_file = xstrfmt("%s/config", r->commondir);
@@ -1077,7 +1077,7 @@ void write_worktree_linking_files(struct strbuf dotgit, struct strbuf gitdir,
if (use_relative_paths && !the_repository->repository_format_relative_worktrees) {
if (upgrade_repository_format(1) < 0)
die(_("unable to upgrade repository format to support relative worktrees"));
- if (git_config_set_gently("extensions.relativeWorktrees", "true"))
+ if (repo_config_set_gently(the_repository, "extensions.relativeWorktrees", "true"))
die(_("unable to set extensions.relativeWorktrees setting"));
the_repository->repository_format_relative_worktrees = 1;
}
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 14/21] config: drop `git_config_set()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (12 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 13/21] config: drop `git_config_set_gently()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 15/21] config: drop `git_config_set_in_file_gently()` wrapper Patrick Steinhardt
` (7 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_set()`. All
callsites are adjusted so that they use `repo_config_set(the_repository,
...)` instead. While some callsites might already have a repository
available, this mechanical conversion is the exact same as the current
situation and thus cannot cause any regression. Those sites should
eventually be cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/branch.c | 2 +-
builtin/clone.c | 8 ++++----
builtin/gc.c | 4 ++--
builtin/remote.c | 16 ++++++++--------
compat/precompose_utf8.c | 4 ++--
config.c | 2 +-
config.h | 5 -----
list-objects-filter-options.c | 6 +++---
setup.c | 30 +++++++++++++++---------------
9 files changed, 36 insertions(+), 41 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index 08e50bf77b3..5de0691d18d 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -699,7 +699,7 @@ static int edit_branch_description(const char *branch_name)
strbuf_addf(&name, "branch.%s.description", branch_name);
if (buf.len || exists)
- git_config_set(name.buf, buf.len ? buf.buf : NULL);
+ repo_config_set(the_repository, name.buf, buf.len ? buf.buf : NULL);
strbuf_release(&name);
strbuf_release(&buf);
diff --git a/builtin/clone.c b/builtin/clone.c
index 0d7dd5e8ec9..f025a8f19e0 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -827,7 +827,7 @@ static void write_refspec_config(const char *src_ref_prefix,
if (option_mirror) {
strbuf_addf(&key, "remote.%s.mirror", remote_name);
- git_config_set(key.buf, "true");
+ repo_config_set(the_repository, key.buf, "true");
strbuf_reset(&key);
}
}
@@ -1294,18 +1294,18 @@ int cmd_clone(int argc,
src_ref_prefix = "refs/";
strbuf_addstr(&branch_top, src_ref_prefix);
- git_config_set("core.bare", "true");
+ repo_config_set(the_repository, "core.bare", "true");
} else if (!option_rev) {
strbuf_addf(&branch_top, "refs/remotes/%s/", remote_name);
}
strbuf_addf(&key, "remote.%s.url", remote_name);
- git_config_set(key.buf, repo);
+ repo_config_set(the_repository, key.buf, repo);
strbuf_reset(&key);
if (!option_tags) {
strbuf_addf(&key, "remote.%s.tagOpt", remote_name);
- git_config_set(key.buf, "--no-tags");
+ repo_config_set(the_repository, key.buf, "--no-tags");
strbuf_reset(&key);
}
diff --git a/builtin/gc.c b/builtin/gc.c
index fa62e4f2627..c0fe4e73087 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1913,11 +1913,11 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
options);
/* Disable foreground maintenance */
- git_config_set("maintenance.auto", "false");
+ repo_config_set(the_repository, "maintenance.auto", "false");
/* Set maintenance strategy, if unset */
if (repo_config_get(the_repository, "maintenance.strategy"))
- git_config_set("maintenance.strategy", "incremental");
+ repo_config_set(the_repository, "maintenance.strategy", "incremental");
if (!repo_config_get_string_multi(the_repository, key, &list)) {
for_each_string_list_item(item, list) {
diff --git a/builtin/remote.c b/builtin/remote.c
index 5c4dfc98afa..827639e0398 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -209,7 +209,7 @@ static int add(int argc, const char **argv, const char *prefix,
die(_("'%s' is not a valid remote name"), name);
strbuf_addf(&buf, "remote.%s.url", name);
- git_config_set(buf.buf, url);
+ repo_config_set(the_repository, buf.buf, url);
if (!mirror || mirror & MIRROR_FETCH) {
strbuf_reset(&buf);
@@ -225,14 +225,14 @@ static int add(int argc, const char **argv, const char *prefix,
if (mirror & MIRROR_PUSH) {
strbuf_reset(&buf);
strbuf_addf(&buf, "remote.%s.mirror", name);
- git_config_set(buf.buf, "true");
+ repo_config_set(the_repository, buf.buf, "true");
}
if (fetch_tags != TAGS_DEFAULT) {
strbuf_reset(&buf);
strbuf_addf(&buf, "remote.%s.tagOpt", name);
- git_config_set(buf.buf,
- fetch_tags == TAGS_SET ? "--tags" : "--no-tags");
+ repo_config_set(the_repository, buf.buf,
+ fetch_tags == TAGS_SET ? "--tags" : "--no-tags");
}
if (fetch && fetch_remote(name)) {
@@ -802,12 +802,12 @@ static int mv(int argc, const char **argv, const char *prefix,
if (info->remote_name && !strcmp(info->remote_name, rename.old_name)) {
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.remote", item->string);
- git_config_set(buf.buf, rename.new_name);
+ repo_config_set(the_repository, buf.buf, rename.new_name);
}
if (info->push_remote_name && !strcmp(info->push_remote_name, rename.old_name)) {
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.pushRemote", item->string);
- git_config_set(buf.buf, rename.new_name);
+ repo_config_set(the_repository, buf.buf, rename.new_name);
}
}
@@ -1503,7 +1503,7 @@ static int set_head(int argc, const char **argv, const char *prefix,
struct strbuf config_name = STRBUF_INIT;
strbuf_addf(&config_name,
"remote.%s.followremotehead", remote->name);
- git_config_set(config_name.buf, "warn");
+ repo_config_set(the_repository, config_name.buf, "warn");
strbuf_release(&config_name);
}
@@ -1793,7 +1793,7 @@ static int set_url(int argc, const char **argv, const char *prefix,
git_config_set_multivar(name_buf.buf, newurl,
"^$", 0);
else
- git_config_set(name_buf.buf, newurl);
+ repo_config_set(the_repository, name_buf.buf, newurl);
goto out;
}
diff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c
index 3985ed108eb..43b3be01143 100644
--- a/compat/precompose_utf8.c
+++ b/compat/precompose_utf8.c
@@ -56,8 +56,8 @@ void probe_utf8_pathname_composition(void)
close(output_fd);
repo_git_path_replace(the_repository, &path, "%s", auml_nfd);
precomposed_unicode = access(path.buf, R_OK) ? 0 : 1;
- git_config_set("core.precomposeunicode",
- precomposed_unicode ? "true" : "false");
+ repo_config_set(the_repository, "core.precomposeunicode",
+ precomposed_unicode ? "true" : "false");
repo_git_path_replace(the_repository, &path, "%s", auml_nfc);
if (unlink(path.buf))
die_errno(_("failed to unlink '%s'"), path.buf);
diff --git a/config.c b/config.c
index 095a17bd429..285cab0ce2a 100644
--- a/config.c
+++ b/config.c
@@ -2748,7 +2748,7 @@ void git_die_config(struct repository *r, const char *key, const char *err, ...)
}
/*
- * Find all the stuff for git_config_set() below.
+ * Find all the stuff for repo_config_set() below.
*/
struct config_store_data {
diff --git a/config.h b/config.h
index 90977441c3b..43d06c279e3 100644
--- a/config.h
+++ b/config.h
@@ -734,11 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)
return repo_config_get_pathname(the_repository, key, dest);
}
-static inline void git_config_set(const char *key, const char *value)
-{
- repo_config_set(the_repository, key, value);
-}
-
static inline int git_config_set_in_file_gently(
const char *config_filename,
const char *key,
diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
index 948376d42d0..7420bf81fe0 100644
--- a/list-objects-filter-options.c
+++ b/list-objects-filter-options.c
@@ -350,7 +350,7 @@ void partial_clone_register(
/* Add promisor config for the remote */
cfg_name = xstrfmt("remote.%s.promisor", remote);
- git_config_set(cfg_name, "true");
+ repo_config_set(the_repository, cfg_name, "true");
free(cfg_name);
}
@@ -360,8 +360,8 @@ void partial_clone_register(
*/
filter_name = xstrfmt("remote.%s.partialclonefilter", remote);
/* NEEDSWORK: 'expand' result leaking??? */
- git_config_set(filter_name,
- expand_list_objects_filter_spec(filter_options));
+ repo_config_set(the_repository, filter_name,
+ expand_list_objects_filter_spec(filter_options));
free(filter_name);
/* Make sure the config info are reset */
diff --git a/setup.c b/setup.c
index a05c348dcdf..98ddbf377f9 100644
--- a/setup.c
+++ b/setup.c
@@ -815,7 +815,7 @@ int upgrade_repository_format(int target_version)
}
strbuf_addf(&repo_version, "%d", target_version);
- git_config_set("core.repositoryformatversion", repo_version.buf);
+ repo_config_set(the_repository, "core.repositoryformatversion", repo_version.buf);
ret = 1;
@@ -2233,14 +2233,14 @@ void initialize_repository_version(int hash_algo,
target_version = GIT_REPO_VERSION_READ;
if (hash_algo != GIT_HASH_SHA1_LEGACY && hash_algo != GIT_HASH_UNKNOWN)
- git_config_set("extensions.objectformat",
- hash_algos[hash_algo].name);
+ repo_config_set(the_repository, "extensions.objectformat",
+ hash_algos[hash_algo].name);
else if (reinit)
repo_config_set_gently(the_repository, "extensions.objectformat", NULL);
if (ref_storage_format != REF_STORAGE_FORMAT_FILES)
- git_config_set("extensions.refstorage",
- ref_storage_format_to_name(ref_storage_format));
+ repo_config_set(the_repository, "extensions.refstorage",
+ ref_storage_format_to_name(ref_storage_format));
else if (reinit)
repo_config_set_gently(the_repository, "extensions.refstorage", NULL);
@@ -2259,7 +2259,7 @@ void initialize_repository_version(int hash_algo,
}
strbuf_addf(&repo_version, "%d", target_version);
- git_config_set("core.repositoryformatversion", repo_version.buf);
+ repo_config_set(the_repository, "core.repositoryformatversion", repo_version.buf);
strbuf_release(&repo_version);
}
@@ -2375,17 +2375,17 @@ static int create_default_files(const char *template_path,
if (filemode && !reinit && (st1.st_mode & S_IXUSR))
filemode = 0;
}
- git_config_set("core.filemode", filemode ? "true" : "false");
+ repo_config_set(the_repository, "core.filemode", filemode ? "true" : "false");
if (is_bare_repository())
- git_config_set("core.bare", "true");
+ repo_config_set(the_repository, "core.bare", "true");
else {
- git_config_set("core.bare", "false");
+ repo_config_set(the_repository, "core.bare", "false");
/* allow template config file to override the default */
if (repo_settings_get_log_all_ref_updates(the_repository) == LOG_REFS_UNSET)
- git_config_set("core.logallrefupdates", "true");
+ repo_config_set(the_repository, "core.logallrefupdates", "true");
if (needs_work_tree_config(original_git_dir, work_tree))
- git_config_set("core.worktree", work_tree);
+ repo_config_set(the_repository, "core.worktree", work_tree);
}
if (!reinit) {
@@ -2398,12 +2398,12 @@ static int create_default_files(const char *template_path,
S_ISLNK(st1.st_mode))
unlink(path.buf); /* good */
else
- git_config_set("core.symlinks", "false");
+ repo_config_set(the_repository, "core.symlinks", "false");
/* Check if the filesystem is case-insensitive */
repo_git_path_replace(the_repository, &path, "CoNfIg");
if (!access(path.buf, F_OK))
- git_config_set("core.ignorecase", "true");
+ repo_config_set(the_repository, "core.ignorecase", "true");
probe_utf8_pathname_composition();
}
@@ -2639,8 +2639,8 @@ int init_db(const char *git_dir, const char *real_git_dir,
xsnprintf(buf, sizeof(buf), "%d", OLD_PERM_EVERYBODY);
else
BUG("invalid value for shared_repository");
- git_config_set("core.sharedrepository", buf);
- git_config_set("receive.denyNonFastforwards", "true");
+ repo_config_set(the_repository, "core.sharedrepository", buf);
+ repo_config_set(the_repository, "receive.denyNonFastforwards", "true");
}
if (!(flags & INIT_DB_QUIET)) {
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 15/21] config: drop `git_config_set_in_file_gently()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (13 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 14/21] config: drop `git_config_set()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 16/21] config: drop `git_config_set_multivar_in_file_gently()` wrapper Patrick Steinhardt
` (6 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove
`git_config_set_in_file_gently()`. All callsites are adjusted so that
they use `repo_config_set_in_file_gently(the_repository, ...)` instead.
While some callsites might already have a repository available, this
mechanical conversion is the exact same as the current situation and
thus cannot cause any regression. Those sites should eventually be
cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/config.c | 14 +++++++-------
builtin/submodule--helper.c | 2 +-
builtin/worktree.c | 4 ++--
config.h | 10 ----------
sequencer.c | 28 ++++++++++++++--------------
submodule-config.c | 2 +-
submodule.c | 2 +-
worktree.c | 4 ++--
8 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/builtin/config.c b/builtin/config.c
index af5d79eadc0..f7e718c6702 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -970,8 +970,8 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix,
argv[0], value, value_pattern,
comment, flags);
} else {
- ret = git_config_set_in_file_gently(location_opts.source.file,
- argv[0], comment, value);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], comment, value);
if (ret == CONFIG_NOTHING_SET)
error(_("cannot overwrite multiple values with a single value\n"
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
@@ -1014,8 +1014,8 @@ static int cmd_config_unset(int argc, const char **argv, const char *prefix,
argv[0], NULL, value_pattern,
NULL, flags);
else
- ret = git_config_set_in_file_gently(location_opts.source.file, argv[0],
- NULL, NULL);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0],
+ NULL, NULL);
location_options_release(&location_opts);
return ret;
@@ -1296,7 +1296,7 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
check_write(&location_opts.source);
check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
- ret = git_config_set_in_file_gently(location_opts.source.file, argv[0], comment, value);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0], comment, value);
if (ret == CONFIG_NOTHING_SET)
error(_("cannot overwrite multiple values with a single value\n"
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
@@ -1354,8 +1354,8 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
argv[0], NULL, argv[1],
NULL, flags);
else
- ret = git_config_set_in_file_gently(location_opts.source.file,
- argv[0], NULL, NULL);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], NULL, NULL);
}
else if (actions == ACTION_UNSET_ALL) {
check_write(&location_opts.source);
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 710a2a2004e..28f34f7bc18 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1280,7 +1280,7 @@ static void sync_submodule(const char *path, const char *prefix,
submodule_to_gitdir(the_repository, &sb, path);
strbuf_addstr(&sb, "/config");
- if (git_config_set_in_file_gently(sb.buf, remote_key, NULL, sub_origin_url))
+ if (repo_config_set_in_file_gently(the_repository, sb.buf, remote_key, NULL, sub_origin_url))
die(_("failed to update remote for submodule '%s'"),
path);
diff --git a/builtin/worktree.c b/builtin/worktree.c
index b1306248dec..fd517c82c44 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -384,8 +384,8 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)
error(_("failed to unset '%s' in '%s'"),
"core.bare", to_file);
if (!git_configset_get(&cs, "core.worktree") &&
- git_config_set_in_file_gently(to_file,
- "core.worktree", NULL, NULL))
+ repo_config_set_in_file_gently(the_repository, to_file,
+ "core.worktree", NULL, NULL))
error(_("failed to unset '%s' in '%s'"),
"core.worktree", to_file);
diff --git a/config.h b/config.h
index 43d06c279e3..4e658e47f0a 100644
--- a/config.h
+++ b/config.h
@@ -734,16 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)
return repo_config_get_pathname(the_repository, key, dest);
}
-static inline int git_config_set_in_file_gently(
- const char *config_filename,
- const char *key,
- const char *comment,
- const char *value)
-{
- return repo_config_set_in_file_gently(the_repository, config_filename,
- key, comment, value);
-}
-
static inline int git_config_set_multivar_in_file_gently(
const char *config_filename,
const char *key, const char *value,
diff --git a/sequencer.c b/sequencer.c
index f8d9bb69df8..8acb699f4f2 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3650,57 +3650,57 @@ static int save_opts(struct replay_opts *opts)
int res = 0;
if (opts->no_commit)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.no-commit", NULL, "true");
if (opts->edit >= 0)
- res |= git_config_set_in_file_gently(opts_file, "options.edit", NULL,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file, "options.edit", NULL,
opts->edit ? "true" : "false");
if (opts->allow_empty)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.allow-empty", NULL, "true");
if (opts->allow_empty_message)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.allow-empty-message", NULL, "true");
if (opts->drop_redundant_commits)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.drop-redundant-commits", NULL, "true");
if (opts->keep_redundant_commits)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.keep-redundant-commits", NULL, "true");
if (opts->signoff)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.signoff", NULL, "true");
if (opts->record_origin)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.record-origin", NULL, "true");
if (opts->allow_ff)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.allow-ff", NULL, "true");
if (opts->mainline) {
struct strbuf buf = STRBUF_INIT;
strbuf_addf(&buf, "%d", opts->mainline);
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.mainline", NULL, buf.buf);
strbuf_release(&buf);
}
if (opts->strategy)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.strategy", NULL, opts->strategy);
if (opts->gpg_sign)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.gpg-sign", NULL, opts->gpg_sign);
for (size_t i = 0; i < opts->xopts.nr; i++)
res |= git_config_set_multivar_in_file_gently(opts_file,
"options.strategy-option",
opts->xopts.v[i], "^$", NULL, 0);
if (opts->allow_rerere_auto)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.allow-rerere-auto", NULL,
opts->allow_rerere_auto == RERERE_AUTOUPDATE ?
"true" : "false");
if (opts->explicit_cleanup)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.default-msg-cleanup", NULL,
describe_cleanup_mode(opts->default_msg_cleanup));
return res;
diff --git a/submodule-config.c b/submodule-config.c
index 70324da3830..1f19fe20774 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -983,7 +983,7 @@ int config_set_in_gitmodules_file_gently(const char *key, const char *value)
{
int ret;
- ret = git_config_set_in_file_gently(GITMODULES_FILE, key, NULL, value);
+ ret = repo_config_set_in_file_gently(the_repository, GITMODULES_FILE, key, NULL, value);
if (ret < 0)
/* Maybe the user already did that, don't error out here */
warning(_("Could not update .gitmodules entry %s"), key);
diff --git a/submodule.c b/submodule.c
index f8373a9ea7d..fff3c755703 100644
--- a/submodule.c
+++ b/submodule.c
@@ -2058,7 +2058,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, NULL))
+ if (repo_config_set_in_file_gently(the_repository, config_path.buf, "core.worktree", NULL, NULL))
warning(_("Could not unset core.worktree setting in submodule '%s'"),
sub->path);
diff --git a/worktree.c b/worktree.c
index 981a2713374..a2a5f51f29f 100644
--- a/worktree.c
+++ b/worktree.c
@@ -991,9 +991,9 @@ int should_prune_worktree(const char *id, struct strbuf *reason, char **wtpath,
static int move_config_setting(const char *key, const char *value,
const char *from_file, const char *to_file)
{
- if (git_config_set_in_file_gently(to_file, key, NULL, value))
+ if (repo_config_set_in_file_gently(the_repository, to_file, key, NULL, value))
return error(_("unable to set %s in '%s'"), key, to_file);
- if (git_config_set_in_file_gently(from_file, key, NULL, NULL))
+ if (repo_config_set_in_file_gently(the_repository, from_file, key, NULL, NULL))
return error(_("unable to unset %s in '%s'"), key, from_file);
return 0;
}
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 16/21] config: drop `git_config_set_multivar_in_file_gently()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (14 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 15/21] config: drop `git_config_set_in_file_gently()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 17/21] config: drop `git_config_get_multivar_gently()` wrapper Patrick Steinhardt
` (5 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove
`git_config_set_multivar_in_file_gently()`. All callsites are adjusted
so that they use
`repo_config_set_multivar_in_file_gently(the_repository, ...)` instead.
While some callsites might already have a repository available, this
mechanical conversion is the exact same as the current situation and
thus cannot cause any regression. Those sites should eventually be
cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/config.c | 44 ++++++++++++++++++++++----------------------
builtin/gc.c | 4 ++--
builtin/worktree.c | 2 +-
config.h | 12 ------------
sequencer.c | 2 +-
5 files changed, 26 insertions(+), 38 deletions(-)
diff --git a/builtin/config.c b/builtin/config.c
index f7e718c6702..59fb113b073 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -966,9 +966,9 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix,
value = normalize_value(argv[0], argv[1], type, &default_kvi);
if ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern) {
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], value, value_pattern,
- comment, flags);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], value, value_pattern,
+ comment, flags);
} else {
ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
argv[0], comment, value);
@@ -1010,9 +1010,9 @@ static int cmd_config_unset(int argc, const char **argv, const char *prefix,
check_write(&location_opts.source);
if ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern)
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], NULL, value_pattern,
- NULL, flags);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], NULL, value_pattern,
+ NULL, flags);
else
ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0],
NULL, NULL);
@@ -1305,26 +1305,26 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
check_write(&location_opts.source);
check_argc(argc, 2, 3);
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], value, argv[2],
- comment, flags);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], value, argv[2],
+ comment, flags);
}
else if (actions == ACTION_ADD) {
check_write(&location_opts.source);
check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], value,
- CONFIG_REGEX_NONE,
- comment, flags);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], value,
+ CONFIG_REGEX_NONE,
+ comment, flags);
}
else if (actions == ACTION_REPLACE_ALL) {
check_write(&location_opts.source);
check_argc(argc, 2, 3);
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], value, argv[2],
- comment, flags | CONFIG_FLAGS_MULTI_REPLACE);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], value, argv[2],
+ comment, flags | CONFIG_FLAGS_MULTI_REPLACE);
}
else if (actions == ACTION_GET) {
check_argc(argc, 1, 2);
@@ -1350,9 +1350,9 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
check_write(&location_opts.source);
check_argc(argc, 1, 2);
if (argc == 2)
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], NULL, argv[1],
- NULL, flags);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], NULL, argv[1],
+ NULL, flags);
else
ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
argv[0], NULL, NULL);
@@ -1360,9 +1360,9 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
else if (actions == ACTION_UNSET_ALL) {
check_write(&location_opts.source);
check_argc(argc, 1, 2);
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], NULL, argv[1],
- NULL, flags | CONFIG_FLAGS_MULTI_REPLACE);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], NULL, argv[1],
+ NULL, flags | CONFIG_FLAGS_MULTI_REPLACE);
}
else if (actions == ACTION_RENAME_SECTION) {
check_write(&location_opts.source);
diff --git a/builtin/gc.c b/builtin/gc.c
index c0fe4e73087..183798f0dc9 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1938,7 +1938,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
}
if (!config_file)
die(_("$HOME not set"));
- rc = git_config_set_multivar_in_file_gently(
+ rc = repo_config_set_multivar_in_file_gently(the_repository,
config_file, "maintenance.repo", maintpath,
CONFIG_REGEX_NONE, NULL, 0);
free(global_config_file);
@@ -2007,7 +2007,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
}
if (!config_file)
die(_("$HOME not set"));
- rc = git_config_set_multivar_in_file_gently(
+ rc = repo_config_set_multivar_in_file_gently(the_repository,
config_file, key, NULL, maintpath, NULL,
CONFIG_FLAGS_MULTI_REPLACE | CONFIG_FLAGS_FIXED_VALUE);
free(global_config_file);
diff --git a/builtin/worktree.c b/builtin/worktree.c
index fd517c82c44..812774a5ca9 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -379,7 +379,7 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)
if (!git_configset_get_bool(&cs, "core.bare", &bare) &&
bare &&
- git_config_set_multivar_in_file_gently(
+ repo_config_set_multivar_in_file_gently(the_repository,
to_file, "core.bare", NULL, "true", NULL, 0))
error(_("failed to unset '%s' in '%s'"),
"core.bare", to_file);
diff --git a/config.h b/config.h
index 4e658e47f0a..e69592ada15 100644
--- a/config.h
+++ b/config.h
@@ -734,18 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)
return repo_config_get_pathname(the_repository, key, dest);
}
-static inline int git_config_set_multivar_in_file_gently(
- const char *config_filename,
- const char *key, const char *value,
- const char *value_pattern,
- const char *comment,
- unsigned flags)
-{
- return repo_config_set_multivar_in_file_gently(the_repository, config_filename,
- key, value, value_pattern,
- comment, flags);
-}
-
static inline void git_config_set_multivar_in_file(
const char *config_filename,
const char *key,
diff --git a/sequencer.c b/sequencer.c
index 8acb699f4f2..aaf2e4df64e 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3690,7 +3690,7 @@ static int save_opts(struct replay_opts *opts)
res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.gpg-sign", NULL, opts->gpg_sign);
for (size_t i = 0; i < opts->xopts.nr; i++)
- res |= git_config_set_multivar_in_file_gently(opts_file,
+ res |= repo_config_set_multivar_in_file_gently(the_repository, opts_file,
"options.strategy-option",
opts->xopts.v[i], "^$", NULL, 0);
if (opts->allow_rerere_auto)
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 17/21] config: drop `git_config_get_multivar_gently()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (15 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 16/21] config: drop `git_config_set_multivar_in_file_gently()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 18/21] config: drop `git_config_set_multivar()` wrapper Patrick Steinhardt
` (4 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove
`git_config_get_multivar_gently()`. All callsites are adjusted so that
they use `repo_config_get_multivar_gently(the_repository, ...)` instead.
While some callsites might already have a repository available, this
mechanical conversion is the exact same as the current situation and
thus cannot cause any regression. Those sites should eventually be
cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
branch.c | 2 +-
builtin/clone.c | 8 ++++----
builtin/remote.c | 4 ++--
config.h | 7 -------
scalar.c | 6 +++---
5 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/branch.c b/branch.c
index 3dc237adf6c..26be3583471 100644
--- a/branch.c
+++ b/branch.c
@@ -130,7 +130,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
if (repo_config_set_gently(the_repository, key.buf, NULL) < 0)
goto out_err;
for_each_string_list_item(item, remotes)
- if (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
+ if (repo_config_set_multivar_gently(the_repository, key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
goto out_err;
if (rebasing) {
diff --git a/builtin/clone.c b/builtin/clone.c
index f025a8f19e0..183297787cb 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -762,16 +762,16 @@ static int write_one_config(const char *key, const char *value,
{
/*
* give git_clone_config a chance to write config values back to the
- * environment, since git_config_set_multivar_gently only deals with
+ * environment, since repo_config_set_multivar_gently only deals with
* config-file writes
*/
int apply_failed = git_clone_config(key, value, ctx, data);
if (apply_failed)
return apply_failed;
- return git_config_set_multivar_gently(key,
- value ? value : "true",
- CONFIG_REGEX_NONE, 0);
+ return repo_config_set_multivar_gently(the_repository, key,
+ value ? value : "true",
+ CONFIG_REGEX_NONE, 0);
}
static void write_config(struct string_list *config)
diff --git a/builtin/remote.c b/builtin/remote.c
index 827639e0398..dd340a33259 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1633,8 +1633,8 @@ static int update(int argc, const char **argv, const char *prefix,
static int remove_all_fetch_refspecs(const char *key)
{
- return git_config_set_multivar_gently(key, NULL, NULL,
- CONFIG_FLAGS_MULTI_REPLACE);
+ return repo_config_set_multivar_gently(the_repository, key, NULL, NULL,
+ CONFIG_FLAGS_MULTI_REPLACE);
}
static void add_branches(struct remote *remote, const char **branches,
diff --git a/config.h b/config.h
index e69592ada15..a90b814292c 100644
--- a/config.h
+++ b/config.h
@@ -745,13 +745,6 @@ static inline void git_config_set_multivar_in_file(
key, value, value_pattern, flags);
}
-static inline int git_config_set_multivar_gently(const char *key, const char *value,
- const char *value_pattern, unsigned flags)
-{
- return repo_config_set_multivar_gently(the_repository, key, value,
- value_pattern, flags);
-}
-
static inline void git_config_set_multivar(const char *key, const char *value,
const char *value_pattern, unsigned flags)
{
diff --git a/scalar.c b/scalar.c
index c09c5ca194e..4a373c133d8 100644
--- a/scalar.c
+++ b/scalar.c
@@ -196,9 +196,9 @@ static int set_recommended_config(int reconfigure)
if (repo_config_get_string(the_repository, "log.excludeDecoration", &value)) {
trace2_data_string("scalar", the_repository,
"log.excludeDecoration", "created");
- if (git_config_set_multivar_gently("log.excludeDecoration",
- "refs/prefetch/*",
- CONFIG_REGEX_NONE, 0))
+ if (repo_config_set_multivar_gently(the_repository, "log.excludeDecoration",
+ "refs/prefetch/*",
+ CONFIG_REGEX_NONE, 0))
return error(_("could not configure "
"log.excludeDecoration"));
} else {
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 18/21] config: drop `git_config_set_multivar()` wrapper
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (16 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 17/21] config: drop `git_config_get_multivar_gently()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 19/21] config: remove unused `the_repository` wrappers Patrick Steinhardt
` (3 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_set_multivar()`.
All callsites are adjusted so that they use
`repo_config_set_multivar(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/branch.c | 4 ++--
builtin/clone.c | 2 +-
builtin/remote.c | 20 ++++++++++----------
config.h | 7 -------
4 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index 5de0691d18d..fa5ced452e5 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -987,10 +987,10 @@ int cmd_branch(int argc,
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.remote", branch->name);
- git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
+ repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.merge", branch->name);
- git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
+ repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
strbuf_release(&buf);
} else if (!noncreate_actions && argc > 0 && argc <= 2) {
const char *branch_name = argv[0];
diff --git a/builtin/clone.c b/builtin/clone.c
index 183297787cb..c990f398ef6 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -822,7 +822,7 @@ static void write_refspec_config(const char *src_ref_prefix,
/* Configure the remote */
if (value.len) {
strbuf_addf(&key, "remote.%s.fetch", remote_name);
- git_config_set_multivar(key.buf, value.buf, "^$", 0);
+ repo_config_set_multivar(the_repository, key.buf, value.buf, "^$", 0);
strbuf_reset(&key);
if (option_mirror) {
diff --git a/builtin/remote.c b/builtin/remote.c
index dd340a33259..4c63a8bb576 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -132,7 +132,7 @@ static void add_branch(const char *key, const char *branchname,
else
strbuf_addf(tmp, "refs/heads/%s:refs/remotes/%s/%s",
branchname, remotename, branchname);
- git_config_set_multivar(key, tmp->buf, "^$", 0);
+ repo_config_set_multivar(the_repository, key, tmp->buf, "^$", 0);
}
static const char mirror_advice[] =
@@ -634,15 +634,15 @@ static int migrate_file(struct remote *remote)
strbuf_addf(&buf, "remote.%s.url", remote->name);
for (i = 0; i < remote->url.nr; i++)
- git_config_set_multivar(buf.buf, remote->url.v[i], "^$", 0);
+ repo_config_set_multivar(the_repository, buf.buf, remote->url.v[i], "^$", 0);
strbuf_reset(&buf);
strbuf_addf(&buf, "remote.%s.push", remote->name);
for (i = 0; i < remote->push.nr; i++)
- git_config_set_multivar(buf.buf, remote->push.items[i].raw, "^$", 0);
+ repo_config_set_multivar(the_repository, buf.buf, remote->push.items[i].raw, "^$", 0);
strbuf_reset(&buf);
strbuf_addf(&buf, "remote.%s.fetch", remote->name);
for (i = 0; i < remote->fetch.nr; i++)
- git_config_set_multivar(buf.buf, remote->fetch.items[i].raw, "^$", 0);
+ repo_config_set_multivar(the_repository, buf.buf, remote->fetch.items[i].raw, "^$", 0);
#ifndef WITH_BREAKING_CHANGES
if (remote->origin == REMOTE_REMOTES)
unlink_or_warn(repo_git_path_replace(the_repository, &buf,
@@ -771,7 +771,7 @@ static int mv(int argc, const char **argv, const char *prefix,
if (oldremote->fetch.nr) {
strbuf_reset(&buf);
strbuf_addf(&buf, "remote.%s.fetch", rename.new_name);
- git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
+ repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old_name);
for (i = 0; i < oldremote->fetch.nr; i++) {
char *ptr;
@@ -791,7 +791,7 @@ static int mv(int argc, const char **argv, const char *prefix,
"\tPlease update the configuration manually if necessary."),
buf2.buf);
- git_config_set_multivar(buf.buf, buf2.buf, "^$", 0);
+ repo_config_set_multivar(the_repository, buf.buf, buf2.buf, "^$", 0);
}
}
@@ -1790,7 +1790,7 @@ static int set_url(int argc, const char **argv, const char *prefix,
/* Special cases that add new entry. */
if ((!oldurl && !delete_mode) || add_mode) {
if (add_mode)
- git_config_set_multivar(name_buf.buf, newurl,
+ repo_config_set_multivar(the_repository, name_buf.buf, newurl,
"^$", 0);
else
repo_config_set(the_repository, name_buf.buf, newurl);
@@ -1814,10 +1814,10 @@ static int set_url(int argc, const char **argv, const char *prefix,
regfree(&old_regex);
if (!delete_mode)
- git_config_set_multivar(name_buf.buf, newurl, oldurl, 0);
+ repo_config_set_multivar(the_repository, name_buf.buf, newurl, oldurl, 0);
else
- git_config_set_multivar(name_buf.buf, NULL, oldurl,
- CONFIG_FLAGS_MULTI_REPLACE);
+ repo_config_set_multivar(the_repository, name_buf.buf, NULL, oldurl,
+ CONFIG_FLAGS_MULTI_REPLACE);
out:
strbuf_release(&name_buf);
return 0;
diff --git a/config.h b/config.h
index a90b814292c..61774f17db3 100644
--- a/config.h
+++ b/config.h
@@ -744,13 +744,6 @@ static inline void git_config_set_multivar_in_file(
repo_config_set_multivar_in_file(the_repository, config_filename,
key, value, value_pattern, flags);
}
-
-static inline void git_config_set_multivar(const char *key, const char *value,
- const char *value_pattern, unsigned flags)
-{
- repo_config_set_multivar(the_repository, key, value,
- value_pattern, flags);
-}
# endif /* USE_THE_REPOSITORY_VARIABLE */
#endif /* CONFIG_H */
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 19/21] config: remove unused `the_repository` wrappers
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (17 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 18/21] config: drop `git_config_set_multivar()` wrapper Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 20/21] config: move Git config parsing into "environment.c" Patrick Steinhardt
` (2 subsequent siblings)
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
Remove the last couple of wrapper functions that implicitly depend on
`the_repository`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
config.h | 28 ----------------------------
1 file changed, 28 deletions(-)
diff --git a/config.h b/config.h
index 61774f17db3..87baf8eeffe 100644
--- a/config.h
+++ b/config.h
@@ -718,32 +718,4 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
lookup_config(mapping, ARRAY_SIZE(mapping), var)
int lookup_config(const char **mapping, int nr_mapping, const char *var);
-# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest)
-{
- return repo_config_get_bool_or_int(the_repository, key, is_bool, dest);
-}
-
-static inline int git_config_get_maybe_bool(const char *key, int *dest)
-{
- return repo_config_get_maybe_bool(the_repository, key, dest);
-}
-
-static inline int git_config_get_pathname(const char *key, char **dest)
-{
- return repo_config_get_pathname(the_repository, key, dest);
-}
-
-static inline void git_config_set_multivar_in_file(
- const char *config_filename,
- const char *key,
- const char *value,
- const char *value_pattern,
- unsigned flags)
-{
- repo_config_set_multivar_in_file(the_repository, config_filename,
- key, value, value_pattern, flags);
-}
-# endif /* USE_THE_REPOSITORY_VARIABLE */
-
#endif /* CONFIG_H */
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 20/21] config: move Git config parsing into "environment.c"
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (18 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 19/21] config: remove unused `the_repository` wrappers Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 21/21] config: fix sign comparison warnings Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
21 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
In "config.c" we host both the business logic to read and write config
files as well as the logic to parse specific Git-related variables. On
the one hand this is mixing concerns, but even more importantly it means
that we cannot easily remove the dependency on `the_repository` in our
config parsing logic.
Move the logic into "environment.c". This file is a grab bag of all
kinds of global state already, so it is quite a good fit. Furthermore,
it also hosts most of the global variables that we're parsing the config
values into, making this an even better fit.
Note that there is one hidden change: in `parse_fsync_components()` we
use an `int` to iterate through `ARRAY_SIZE(fsync_component_names)`. But
as -Wsign-compare warnings are enabled in this file this causes a
compiler warning. The issue is fixed by using a `size_t` instead.
This change allows us to drop the `USE_THE_REPOSITORY_VARIABLE`
declaration.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/add.c | 1 +
builtin/check-ignore.c | 1 +
builtin/check-mailmap.c | 1 +
builtin/checkout--worker.c | 1 +
builtin/checkout-index.c | 1 +
builtin/clean.c | 1 +
builtin/commit-graph.c | 1 +
builtin/commit-tree.c | 1 +
builtin/count-objects.c | 1 +
builtin/credential.c | 1 +
builtin/fast-export.c | 1 +
builtin/for-each-ref.c | 1 +
builtin/fsmonitor--daemon.c | 1 +
builtin/grep.c | 1 +
builtin/hash-object.c | 1 +
builtin/help.c | 1 +
builtin/hook.c | 1 +
builtin/interpret-trailers.c | 1 +
builtin/ls-files.c | 1 +
builtin/ls-tree.c | 1 +
builtin/merge-base.c | 1 +
builtin/merge-tree.c | 1 +
builtin/multi-pack-index.c | 1 +
builtin/pack-refs.c | 1 +
builtin/patch-id.c | 1 +
builtin/pull.c | 1 +
builtin/read-tree.c | 1 +
builtin/replace.c | 1 +
builtin/rm.c | 1 +
builtin/send-pack.c | 1 +
builtin/show-ref.c | 1 +
builtin/symbolic-ref.c | 1 +
builtin/unpack-file.c | 1 +
builtin/update-ref.c | 1 +
builtin/update-server-info.c | 1 +
builtin/var.c | 1 +
builtin/verify-commit.c | 1 +
builtin/verify-pack.c | 1 +
builtin/verify-tag.c | 1 +
builtin/write-tree.c | 1 +
commit-graph.c | 1 +
config.c | 511 ------------------------------------------
config.h | 3 -
environment.c | 512 +++++++++++++++++++++++++++++++++++++++++++
environment.h | 3 +
fsck.c | 1 +
http-fetch.c | 1 +
http.c | 1 +
imap-send.c | 1 +
mailinfo.c | 1 +
reflog.c | 1 +
rerere.c | 1 +
t/helper/test-advise.c | 1 +
t/helper/test-read-cache.c | 1 +
xdiff-interface.c | 1 +
55 files changed, 566 insertions(+), 514 deletions(-)
diff --git a/builtin/add.c b/builtin/add.c
index 7c292ffdc6c..88d1d330fa8 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -7,6 +7,7 @@
#include "builtin.h"
#include "advice.h"
#include "config.h"
+#include "environment.h"
#include "lockfile.h"
#include "editor.h"
#include "dir.h"
diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c
index 03033499cb0..644c9a414ff 100644
--- a/builtin/check-ignore.c
+++ b/builtin/check-ignore.c
@@ -2,6 +2,7 @@
#include "builtin.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
#include "gettext.h"
#include "quote.h"
#include "pathspec.h"
diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c
index 634626c6728..9cc5c598302 100644
--- a/builtin/check-mailmap.c
+++ b/builtin/check-mailmap.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "ident.h"
#include "mailmap.h"
diff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c
index 27a7d4f0409..e0772b718b2 100644
--- a/builtin/checkout--worker.c
+++ b/builtin/checkout--worker.c
@@ -4,6 +4,7 @@
#include "builtin.h"
#include "config.h"
#include "entry.h"
+#include "environment.h"
#include "gettext.h"
#include "parallel-checkout.h"
#include "parse-options.h"
diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c
index 7f74bc702fa..188128aebd9 100644
--- a/builtin/checkout-index.c
+++ b/builtin/checkout-index.c
@@ -9,6 +9,7 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "lockfile.h"
#include "quote.h"
diff --git a/builtin/clean.c b/builtin/clean.c
index 5ee147c4acc..a1977b92dc8 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -13,6 +13,7 @@
#include "abspath.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "path.h"
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index c5cc601844c..4992ac146e1 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -2,6 +2,7 @@
#include "builtin.h"
#include "commit.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "parse-options.h"
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index 2f1df28d413..5189e685a7e 100644
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
@@ -6,6 +6,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "object-name.h"
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index 433daff805a..b1148a68fa8 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -7,6 +7,7 @@
#include "builtin.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
#include "gettext.h"
#include "path.h"
#include "parse-options.h"
diff --git a/builtin/credential.c b/builtin/credential.c
index 52f172e80cb..a295c80b366 100644
--- a/builtin/credential.c
+++ b/builtin/credential.c
@@ -3,6 +3,7 @@
#include "git-compat-util.h"
#include "credential.h"
#include "builtin.h"
+#include "environment.h"
#include "config.h"
static const char usage_msg[] =
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 17027b859e0..66a3a98c938 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -9,6 +9,7 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "refs.h"
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 3d2207ec773..a8f7f8c7625 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -1,6 +1,7 @@
#include "builtin.h"
#include "commit.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "object.h"
#include "parse-options.h"
diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c
index 469c62b555b..242c594646d 100644
--- a/builtin/fsmonitor--daemon.c
+++ b/builtin/fsmonitor--daemon.c
@@ -5,6 +5,7 @@
#include "abspath.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "fsmonitor-ll.h"
diff --git a/builtin/grep.c b/builtin/grep.c
index 8fcb69dbf2c..5df65373337 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -9,6 +9,7 @@
#include "builtin.h"
#include "abspath.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "config.h"
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index c3ad1e91c96..5d900a6b8c9 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -8,6 +8,7 @@
#include "builtin.h"
#include "abspath.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "object-file.h"
diff --git a/builtin/help.c b/builtin/help.c
index d79ecd946a6..c09cbc8912d 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -6,6 +6,7 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "exec-cmd.h"
#include "gettext.h"
#include "pager.h"
diff --git a/builtin/hook.c b/builtin/hook.c
index 044c27aa95d..7afec380d2e 100644
--- a/builtin/hook.c
+++ b/builtin/hook.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hook.h"
#include "parse-options.h"
diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c
index 3141c37b853..41b0750e5af 100644
--- a/builtin/interpret-trailers.c
+++ b/builtin/interpret-trailers.c
@@ -6,6 +6,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "string-list.h"
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index ff975e7be06..c06a6f33e41 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -11,6 +11,7 @@
#include "builtin.h"
#include "config.h"
#include "convert.h"
+#include "environment.h"
#include "quote.h"
#include "dir.h"
#include "gettext.h"
diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c
index 4ba84e51967..5d55731ca35 100644
--- a/builtin/ls-tree.c
+++ b/builtin/ls-tree.c
@@ -7,6 +7,7 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "object-name.h"
diff --git a/builtin/merge-base.c b/builtin/merge-base.c
index 8fde35c1751..3f82781245b 100644
--- a/builtin/merge-base.c
+++ b/builtin/merge-base.c
@@ -2,6 +2,7 @@
#include "builtin.h"
#include "config.h"
#include "commit.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "object-name.h"
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index 99a6495fd52..203f0e6456a 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
+#include "environment.h"
#include "tree-walk.h"
#include "xdiff-interface.h"
#include "help.h"
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index 9a113f0f1f3..d3b9e98be37 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -2,6 +2,7 @@
#include "builtin.h"
#include "abspath.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "midx.h"
diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c
index e47bae1c803..5e28d0f9e80 100644
--- a/builtin/pack-refs.c
+++ b/builtin/pack-refs.c
@@ -1,5 +1,6 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "refs.h"
diff --git a/builtin/patch-id.c b/builtin/patch-id.c
index a659f00531a..d26e9d0c1ea 100644
--- a/builtin/patch-id.c
+++ b/builtin/patch-id.c
@@ -3,6 +3,7 @@
#include "builtin.h"
#include "config.h"
#include "diff.h"
+#include "environment.h"
#include "gettext.h"
#include "hash.h"
#include "hex.h"
diff --git a/builtin/pull.c b/builtin/pull.c
index 5ea51c31f58..e6d3535c3b5 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -11,6 +11,7 @@
#include "builtin.h"
#include "advice.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "merge.h"
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index 00eef756e67..34f7a59f38e 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -6,6 +6,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "lockfile.h"
diff --git a/builtin/replace.c b/builtin/replace.c
index 3fe39e9df73..19897ef927f 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -11,6 +11,7 @@
#include "builtin.h"
#include "config.h"
#include "editor.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "refs.h"
diff --git a/builtin/rm.c b/builtin/rm.c
index 8c0da7a3ce7..05d89e98c3c 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -9,6 +9,7 @@
#include "builtin.h"
#include "advice.h"
#include "config.h"
+#include "environment.h"
#include "lockfile.h"
#include "dir.h"
#include "gettext.h"
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 28b69d26b48..8b81c8a8486 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -1,5 +1,6 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "hex.h"
#include "pkt-line.h"
#include "run-command.h"
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 414e55b92d5..0b6f9edf86c 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "refs/refs-internal.h"
diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c
index 5c4623067c5..231e41e715b 100644
--- a/builtin/symbolic-ref.c
+++ b/builtin/symbolic-ref.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "refs.h"
#include "parse-options.h"
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c
index ae871adc909..87877a9fabc 100644
--- a/builtin/unpack-file.c
+++ b/builtin/unpack-file.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "hex.h"
#include "object-file.h"
#include "object-name.h"
diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index cb936643243..195437e7c65 100644
--- a/builtin/update-ref.c
+++ b/builtin/update-ref.c
@@ -3,6 +3,7 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hash.h"
#include "hex.h"
diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c
index ba702d30efd..4c12968a836 100644
--- a/builtin/update-server-info.c
+++ b/builtin/update-server-info.c
@@ -1,5 +1,6 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "server-info.h"
diff --git a/builtin/var.c b/builtin/var.c
index beeac12dccf..a2d790d4532 100644
--- a/builtin/var.c
+++ b/builtin/var.c
@@ -11,6 +11,7 @@
#include "attr.h"
#include "config.h"
#include "editor.h"
+#include "environment.h"
#include "ident.h"
#include "pager.h"
#include "refs.h"
diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c
index 5f749a30daf..62398acd721 100644
--- a/builtin/verify-commit.c
+++ b/builtin/verify-commit.c
@@ -7,6 +7,7 @@
*/
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "object-name.h"
#include "commit.h"
diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c
index d9f66f5e767..65fd6629a00 100644
--- a/builtin/verify-pack.c
+++ b/builtin/verify-pack.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "run-command.h"
#include "parse-options.h"
diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c
index ed1c40338fd..cd6bc11095d 100644
--- a/builtin/verify-tag.c
+++ b/builtin/verify-tag.c
@@ -7,6 +7,7 @@
*/
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "tag.h"
#include "object-name.h"
diff --git a/builtin/write-tree.c b/builtin/write-tree.c
index 3465c70a48a..e3bd1a40dbf 100644
--- a/builtin/write-tree.c
+++ b/builtin/write-tree.c
@@ -6,6 +6,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "tree.h"
diff --git a/commit-graph.c b/commit-graph.c
index bd7b6f5338b..e0d92b816f5 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -4,6 +4,7 @@
#include "git-compat-util.h"
#include "config.h"
#include "csum-file.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "lockfile.h"
diff --git a/config.c b/config.c
index 285cab0ce2a..947fba3d8d4 100644
--- a/config.c
+++ b/config.c
@@ -6,12 +6,10 @@
*
*/
-#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "abspath.h"
-#include "advice.h"
#include "date.h"
#include "branch.h"
#include "config.h"
@@ -20,11 +18,8 @@
#include "environment.h"
#include "gettext.h"
#include "git-zlib.h"
-#include "ident.h"
#include "repository.h"
#include "lockfile.h"
-#include "mailmap.h"
-#include "attr.h"
#include "exec-cmd.h"
#include "strbuf.h"
#include "quote.h"
@@ -32,7 +27,6 @@
#include "string-list.h"
#include "object-name.h"
#include "odb.h"
-#include "pager.h"
#include "path.h"
#include "utf8.h"
#include "color.h"
@@ -41,7 +35,6 @@
#include "strvec.h"
#include "trace2.h"
#include "wildmatch.h"
-#include "ws.h"
#include "write-or-die.h"
struct config_source {
@@ -71,9 +64,6 @@ struct config_source {
};
#define CONFIG_SOURCE_INIT { 0 }
-static int pack_compression_seen;
-static int zlib_compression_seen;
-
/*
* Config that comes from trusted scopes, namely:
* - CONFIG_SCOPE_SYSTEM (e.g. /etc/gitconfig)
@@ -1262,80 +1252,6 @@ double git_config_double(const char *name, const char *value,
return ret;
}
-static const struct fsync_component_name {
- const char *name;
- enum fsync_component component_bits;
-} fsync_component_names[] = {
- { "loose-object", FSYNC_COMPONENT_LOOSE_OBJECT },
- { "pack", FSYNC_COMPONENT_PACK },
- { "pack-metadata", FSYNC_COMPONENT_PACK_METADATA },
- { "commit-graph", FSYNC_COMPONENT_COMMIT_GRAPH },
- { "index", FSYNC_COMPONENT_INDEX },
- { "objects", FSYNC_COMPONENTS_OBJECTS },
- { "reference", FSYNC_COMPONENT_REFERENCE },
- { "derived-metadata", FSYNC_COMPONENTS_DERIVED_METADATA },
- { "committed", FSYNC_COMPONENTS_COMMITTED },
- { "added", FSYNC_COMPONENTS_ADDED },
- { "all", FSYNC_COMPONENTS_ALL },
-};
-
-static enum fsync_component parse_fsync_components(const char *var, const char *string)
-{
- enum fsync_component current = FSYNC_COMPONENTS_PLATFORM_DEFAULT;
- enum fsync_component positive = 0, negative = 0;
-
- while (string) {
- int i;
- size_t len;
- const char *ep;
- int negated = 0;
- int found = 0;
-
- string = string + strspn(string, ", \t\n\r");
- ep = strchrnul(string, ',');
- len = ep - string;
- if (!strcmp(string, "none")) {
- current = FSYNC_COMPONENT_NONE;
- goto next_name;
- }
-
- if (*string == '-') {
- negated = 1;
- string++;
- len--;
- if (!len)
- warning(_("invalid value for variable %s"), var);
- }
-
- if (!len)
- break;
-
- for (i = 0; i < ARRAY_SIZE(fsync_component_names); ++i) {
- const struct fsync_component_name *n = &fsync_component_names[i];
-
- if (strncmp(n->name, string, len))
- continue;
-
- found = 1;
- if (negated)
- negative |= n->component_bits;
- else
- positive |= n->component_bits;
- }
-
- if (!found) {
- char *component = xstrndup(string, len);
- warning(_("ignoring unknown core.fsync component '%s'"), component);
- free(component);
- }
-
-next_name:
- string = ep;
- }
-
- return (current & ~negative) | positive;
-}
-
int git_config_bool_or_int(const char *name, const char *value,
const struct key_value_info *kvi, int *is_bool)
{
@@ -1393,433 +1309,6 @@ int git_config_color(char *dest, const char *var, const char *value)
return 0;
}
-static int git_default_core_config(const char *var, const char *value,
- const struct config_context *ctx, void *cb)
-{
- /* This needs a better name */
- if (!strcmp(var, "core.filemode")) {
- trust_executable_bit = git_config_bool(var, value);
- return 0;
- }
- if (!strcmp(var, "core.trustctime")) {
- trust_ctime = git_config_bool(var, value);
- return 0;
- }
- if (!strcmp(var, "core.checkstat")) {
- if (!value)
- return config_error_nonbool(var);
- if (!strcasecmp(value, "default"))
- check_stat = 1;
- else if (!strcasecmp(value, "minimal"))
- check_stat = 0;
- else
- return error(_("invalid value for '%s': '%s'"),
- var, value);
- }
-
- if (!strcmp(var, "core.quotepath")) {
- quote_path_fully = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.symlinks")) {
- has_symlinks = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.ignorecase")) {
- ignore_case = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.attributesfile")) {
- FREE_AND_NULL(git_attributes_file);
- return git_config_pathname(&git_attributes_file, var, value);
- }
-
- if (!strcmp(var, "core.bare")) {
- is_bare_repository_cfg = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.ignorestat")) {
- assume_unchanged = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.abbrev")) {
- if (!value)
- return config_error_nonbool(var);
- if (!strcasecmp(value, "auto"))
- default_abbrev = -1;
- else if (!git_parse_maybe_bool_text(value))
- default_abbrev = GIT_MAX_HEXSZ;
- else {
- int abbrev = git_config_int(var, value, ctx->kvi);
- if (abbrev < minimum_abbrev)
- return error(_("abbrev length out of range: %d"), abbrev);
- default_abbrev = abbrev;
- }
- return 0;
- }
-
- if (!strcmp(var, "core.disambiguate"))
- return set_disambiguate_hint_config(var, value);
-
- if (!strcmp(var, "core.loosecompression")) {
- int level = git_config_int(var, value, ctx->kvi);
- if (level == -1)
- level = Z_DEFAULT_COMPRESSION;
- else if (level < 0 || level > Z_BEST_COMPRESSION)
- die(_("bad zlib compression level %d"), level);
- zlib_compression_level = level;
- zlib_compression_seen = 1;
- return 0;
- }
-
- if (!strcmp(var, "core.compression")) {
- int level = git_config_int(var, value, ctx->kvi);
- if (level == -1)
- level = Z_DEFAULT_COMPRESSION;
- else if (level < 0 || level > Z_BEST_COMPRESSION)
- die(_("bad zlib compression level %d"), level);
- if (!zlib_compression_seen)
- zlib_compression_level = level;
- if (!pack_compression_seen)
- pack_compression_level = level;
- return 0;
- }
-
- if (!strcmp(var, "core.autocrlf")) {
- if (value && !strcasecmp(value, "input")) {
- auto_crlf = AUTO_CRLF_INPUT;
- return 0;
- }
- auto_crlf = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.safecrlf")) {
- int eol_rndtrp_die;
- if (value && !strcasecmp(value, "warn")) {
- global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
- return 0;
- }
- eol_rndtrp_die = git_config_bool(var, value);
- global_conv_flags_eol = eol_rndtrp_die ?
- CONV_EOL_RNDTRP_DIE : 0;
- return 0;
- }
-
- if (!strcmp(var, "core.eol")) {
- if (value && !strcasecmp(value, "lf"))
- core_eol = EOL_LF;
- else if (value && !strcasecmp(value, "crlf"))
- core_eol = EOL_CRLF;
- else if (value && !strcasecmp(value, "native"))
- core_eol = EOL_NATIVE;
- else
- core_eol = EOL_UNSET;
- return 0;
- }
-
- if (!strcmp(var, "core.checkroundtripencoding")) {
- FREE_AND_NULL(check_roundtrip_encoding);
- return git_config_string(&check_roundtrip_encoding, var, value);
- }
-
- if (!strcmp(var, "core.editor")) {
- FREE_AND_NULL(editor_program);
- return git_config_string(&editor_program, var, value);
- }
-
- if (!strcmp(var, "core.commentchar") ||
- !strcmp(var, "core.commentstring")) {
- if (!value)
- return config_error_nonbool(var);
- else if (!strcasecmp(value, "auto"))
- auto_comment_line_char = 1;
- else if (value[0]) {
- if (strchr(value, '\n'))
- return error(_("%s cannot contain newline"), var);
- comment_line_str = value;
- FREE_AND_NULL(comment_line_str_to_free);
- auto_comment_line_char = 0;
- } else
- return error(_("%s must have at least one character"), var);
- return 0;
- }
-
- if (!strcmp(var, "core.askpass")) {
- FREE_AND_NULL(askpass_program);
- return git_config_string(&askpass_program, var, value);
- }
-
- if (!strcmp(var, "core.excludesfile")) {
- FREE_AND_NULL(excludes_file);
- return git_config_pathname(&excludes_file, var, value);
- }
-
- if (!strcmp(var, "core.whitespace")) {
- if (!value)
- return config_error_nonbool(var);
- whitespace_rule_cfg = parse_whitespace_rule(value);
- return 0;
- }
-
- if (!strcmp(var, "core.fsync")) {
- if (!value)
- return config_error_nonbool(var);
- fsync_components = parse_fsync_components(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.fsyncmethod")) {
- if (!value)
- return config_error_nonbool(var);
- if (!strcmp(value, "fsync"))
- fsync_method = FSYNC_METHOD_FSYNC;
- else if (!strcmp(value, "writeout-only"))
- fsync_method = FSYNC_METHOD_WRITEOUT_ONLY;
- else if (!strcmp(value, "batch"))
- fsync_method = FSYNC_METHOD_BATCH;
- else
- warning(_("ignoring unknown core.fsyncMethod value '%s'"), value);
-
- }
-
- if (!strcmp(var, "core.fsyncobjectfiles")) {
- if (fsync_object_files < 0)
- warning(_("core.fsyncObjectFiles is deprecated; use core.fsync instead"));
- fsync_object_files = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.createobject")) {
- if (!value)
- return config_error_nonbool(var);
- if (!strcmp(value, "rename"))
- object_creation_mode = OBJECT_CREATION_USES_RENAMES;
- else if (!strcmp(value, "link"))
- object_creation_mode = OBJECT_CREATION_USES_HARDLINKS;
- else
- die(_("invalid mode for object creation: %s"), value);
- return 0;
- }
-
- if (!strcmp(var, "core.sparsecheckout")) {
- core_apply_sparse_checkout = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.sparsecheckoutcone")) {
- core_sparse_checkout_cone = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.precomposeunicode")) {
- precomposed_unicode = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.protecthfs")) {
- protect_hfs = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.protectntfs")) {
- protect_ntfs = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.maxtreedepth")) {
- max_allowed_tree_depth = git_config_int(var, value, ctx->kvi);
- return 0;
- }
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return platform_core_config(var, value, ctx, cb);
-}
-
-static int git_default_sparse_config(const char *var, const char *value)
-{
- if (!strcmp(var, "sparse.expectfilesoutsideofpatterns")) {
- sparse_expect_files_outside_of_patterns = git_config_bool(var, value);
- return 0;
- }
-
- /* Add other config variables here and to Documentation/config/sparse.adoc. */
- return 0;
-}
-
-static int git_default_i18n_config(const char *var, const char *value)
-{
- if (!strcmp(var, "i18n.commitencoding")) {
- FREE_AND_NULL(git_commit_encoding);
- return git_config_string(&git_commit_encoding, var, value);
- }
-
- if (!strcmp(var, "i18n.logoutputencoding")) {
- FREE_AND_NULL(git_log_output_encoding);
- return git_config_string(&git_log_output_encoding, var, value);
- }
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return 0;
-}
-
-static int git_default_branch_config(const char *var, const char *value)
-{
- if (!strcmp(var, "branch.autosetupmerge")) {
- if (value && !strcmp(value, "always")) {
- git_branch_track = BRANCH_TRACK_ALWAYS;
- return 0;
- } else if (value && !strcmp(value, "inherit")) {
- git_branch_track = BRANCH_TRACK_INHERIT;
- return 0;
- } else if (value && !strcmp(value, "simple")) {
- git_branch_track = BRANCH_TRACK_SIMPLE;
- return 0;
- }
- git_branch_track = git_config_bool(var, value);
- return 0;
- }
- if (!strcmp(var, "branch.autosetuprebase")) {
- if (!value)
- return config_error_nonbool(var);
- else if (!strcmp(value, "never"))
- autorebase = AUTOREBASE_NEVER;
- else if (!strcmp(value, "local"))
- autorebase = AUTOREBASE_LOCAL;
- else if (!strcmp(value, "remote"))
- autorebase = AUTOREBASE_REMOTE;
- else if (!strcmp(value, "always"))
- autorebase = AUTOREBASE_ALWAYS;
- else
- return error(_("malformed value for %s"), var);
- return 0;
- }
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return 0;
-}
-
-static int git_default_push_config(const char *var, const char *value)
-{
- if (!strcmp(var, "push.default")) {
- if (!value)
- return config_error_nonbool(var);
- else if (!strcmp(value, "nothing"))
- push_default = PUSH_DEFAULT_NOTHING;
- else if (!strcmp(value, "matching"))
- push_default = PUSH_DEFAULT_MATCHING;
- else if (!strcmp(value, "simple"))
- push_default = PUSH_DEFAULT_SIMPLE;
- else if (!strcmp(value, "upstream"))
- push_default = PUSH_DEFAULT_UPSTREAM;
- else if (!strcmp(value, "tracking")) /* deprecated */
- push_default = PUSH_DEFAULT_UPSTREAM;
- else if (!strcmp(value, "current"))
- push_default = PUSH_DEFAULT_CURRENT;
- else {
- error(_("malformed value for %s: %s"), var, value);
- return error(_("must be one of nothing, matching, simple, "
- "upstream or current"));
- }
- return 0;
- }
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return 0;
-}
-
-static int git_default_mailmap_config(const char *var, const char *value)
-{
- if (!strcmp(var, "mailmap.file")) {
- FREE_AND_NULL(git_mailmap_file);
- return git_config_pathname(&git_mailmap_file, var, value);
- }
-
- if (!strcmp(var, "mailmap.blob")) {
- FREE_AND_NULL(git_mailmap_blob);
- return git_config_string(&git_mailmap_blob, var, value);
- }
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return 0;
-}
-
-static int git_default_attr_config(const char *var, const char *value)
-{
- if (!strcmp(var, "attr.tree")) {
- FREE_AND_NULL(git_attr_tree);
- return git_config_string(&git_attr_tree, var, value);
- }
-
- /*
- * Add other attribute related config variables here and to
- * Documentation/config/attr.adoc.
- */
- return 0;
-}
-
-int git_default_config(const char *var, const char *value,
- const struct config_context *ctx, void *cb)
-{
- if (starts_with(var, "core."))
- return git_default_core_config(var, value, ctx, cb);
-
- if (starts_with(var, "user.") ||
- starts_with(var, "author.") ||
- starts_with(var, "committer."))
- return git_ident_config(var, value, ctx, cb);
-
- if (starts_with(var, "i18n."))
- return git_default_i18n_config(var, value);
-
- if (starts_with(var, "branch."))
- return git_default_branch_config(var, value);
-
- if (starts_with(var, "push."))
- return git_default_push_config(var, value);
-
- if (starts_with(var, "mailmap."))
- return git_default_mailmap_config(var, value);
-
- if (starts_with(var, "attr."))
- return git_default_attr_config(var, value);
-
- if (starts_with(var, "advice.") || starts_with(var, "color.advice"))
- return git_default_advice_config(var, value);
-
- if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) {
- pager_use_color = git_config_bool(var,value);
- return 0;
- }
-
- if (!strcmp(var, "pack.packsizelimit")) {
- pack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);
- return 0;
- }
-
- if (!strcmp(var, "pack.compression")) {
- int level = git_config_int(var, value, ctx->kvi);
- if (level == -1)
- level = Z_DEFAULT_COMPRESSION;
- else if (level < 0 || level > Z_BEST_COMPRESSION)
- die(_("bad pack compression level %d"), level);
- pack_compression_level = level;
- pack_compression_seen = 1;
- return 0;
- }
-
- if (starts_with(var, "sparse."))
- return git_default_sparse_config(var, value);
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return 0;
-}
-
/*
* All source specific fields in the union, die_on_error, name and the callbacks
* fgetc, ungetc, ftell of top need to be initialized before calling
diff --git a/config.h b/config.h
index 87baf8eeffe..65fc47966e6 100644
--- a/config.h
+++ b/config.h
@@ -165,9 +165,6 @@ struct config_context {
typedef int (*config_fn_t)(const char *, const char *,
const struct config_context *, void *);
-int git_default_config(const char *, const char *,
- const struct config_context *, void *);
-
/**
* Read a specific file in git-config format.
* This function takes the same callback and data parameters as `repo_config`.
diff --git a/environment.c b/environment.c
index 7c2480b22e5..ae1427bb9e8 100644
--- a/environment.c
+++ b/environment.c
@@ -12,22 +12,34 @@
#include "git-compat-util.h"
#include "abspath.h"
+#include "advice.h"
+#include "attr.h"
#include "branch.h"
+#include "color.h"
#include "convert.h"
#include "environment.h"
#include "gettext.h"
#include "git-zlib.h"
+#include "ident.h"
+#include "mailmap.h"
+#include "object-name.h"
#include "repository.h"
#include "config.h"
#include "refs.h"
#include "fmt-merge-msg.h"
#include "commit.h"
#include "strvec.h"
+#include "pager.h"
#include "path.h"
+#include "quote.h"
#include "chdir-notify.h"
#include "setup.h"
+#include "ws.h"
#include "write-or-die.h"
+static int pack_compression_seen;
+static int zlib_compression_seen;
+
int trust_executable_bit = 1;
int trust_ctime = 1;
int check_stat = 1;
@@ -231,3 +243,503 @@ int print_sha1_ellipsis(void)
}
return cached_result;
}
+
+static const struct fsync_component_name {
+ const char *name;
+ enum fsync_component component_bits;
+} fsync_component_names[] = {
+ { "loose-object", FSYNC_COMPONENT_LOOSE_OBJECT },
+ { "pack", FSYNC_COMPONENT_PACK },
+ { "pack-metadata", FSYNC_COMPONENT_PACK_METADATA },
+ { "commit-graph", FSYNC_COMPONENT_COMMIT_GRAPH },
+ { "index", FSYNC_COMPONENT_INDEX },
+ { "objects", FSYNC_COMPONENTS_OBJECTS },
+ { "reference", FSYNC_COMPONENT_REFERENCE },
+ { "derived-metadata", FSYNC_COMPONENTS_DERIVED_METADATA },
+ { "committed", FSYNC_COMPONENTS_COMMITTED },
+ { "added", FSYNC_COMPONENTS_ADDED },
+ { "all", FSYNC_COMPONENTS_ALL },
+};
+
+static enum fsync_component parse_fsync_components(const char *var, const char *string)
+{
+ enum fsync_component current = FSYNC_COMPONENTS_PLATFORM_DEFAULT;
+ enum fsync_component positive = 0, negative = 0;
+
+ while (string) {
+ size_t len;
+ const char *ep;
+ int negated = 0;
+ int found = 0;
+
+ string = string + strspn(string, ", \t\n\r");
+ ep = strchrnul(string, ',');
+ len = ep - string;
+ if (!strcmp(string, "none")) {
+ current = FSYNC_COMPONENT_NONE;
+ goto next_name;
+ }
+
+ if (*string == '-') {
+ negated = 1;
+ string++;
+ len--;
+ if (!len)
+ warning(_("invalid value for variable %s"), var);
+ }
+
+ if (!len)
+ break;
+
+ for (size_t i = 0; i < ARRAY_SIZE(fsync_component_names); ++i) {
+ const struct fsync_component_name *n = &fsync_component_names[i];
+
+ if (strncmp(n->name, string, len))
+ continue;
+
+ found = 1;
+ if (negated)
+ negative |= n->component_bits;
+ else
+ positive |= n->component_bits;
+ }
+
+ if (!found) {
+ char *component = xstrndup(string, len);
+ warning(_("ignoring unknown core.fsync component '%s'"), component);
+ free(component);
+ }
+
+next_name:
+ string = ep;
+ }
+
+ return (current & ~negative) | positive;
+}
+
+static int git_default_core_config(const char *var, const char *value,
+ const struct config_context *ctx, void *cb)
+{
+ /* This needs a better name */
+ if (!strcmp(var, "core.filemode")) {
+ trust_executable_bit = git_config_bool(var, value);
+ return 0;
+ }
+ if (!strcmp(var, "core.trustctime")) {
+ trust_ctime = git_config_bool(var, value);
+ return 0;
+ }
+ if (!strcmp(var, "core.checkstat")) {
+ if (!value)
+ return config_error_nonbool(var);
+ if (!strcasecmp(value, "default"))
+ check_stat = 1;
+ else if (!strcasecmp(value, "minimal"))
+ check_stat = 0;
+ else
+ return error(_("invalid value for '%s': '%s'"),
+ var, value);
+ }
+
+ if (!strcmp(var, "core.quotepath")) {
+ quote_path_fully = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.symlinks")) {
+ has_symlinks = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.ignorecase")) {
+ ignore_case = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.attributesfile")) {
+ FREE_AND_NULL(git_attributes_file);
+ return git_config_pathname(&git_attributes_file, var, value);
+ }
+
+ if (!strcmp(var, "core.bare")) {
+ is_bare_repository_cfg = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.ignorestat")) {
+ assume_unchanged = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.abbrev")) {
+ if (!value)
+ return config_error_nonbool(var);
+ if (!strcasecmp(value, "auto"))
+ default_abbrev = -1;
+ else if (!git_parse_maybe_bool_text(value))
+ default_abbrev = GIT_MAX_HEXSZ;
+ else {
+ int abbrev = git_config_int(var, value, ctx->kvi);
+ if (abbrev < minimum_abbrev)
+ return error(_("abbrev length out of range: %d"), abbrev);
+ default_abbrev = abbrev;
+ }
+ return 0;
+ }
+
+ if (!strcmp(var, "core.disambiguate"))
+ return set_disambiguate_hint_config(var, value);
+
+ if (!strcmp(var, "core.loosecompression")) {
+ int level = git_config_int(var, value, ctx->kvi);
+ if (level == -1)
+ level = Z_DEFAULT_COMPRESSION;
+ else if (level < 0 || level > Z_BEST_COMPRESSION)
+ die(_("bad zlib compression level %d"), level);
+ zlib_compression_level = level;
+ zlib_compression_seen = 1;
+ return 0;
+ }
+
+ if (!strcmp(var, "core.compression")) {
+ int level = git_config_int(var, value, ctx->kvi);
+ if (level == -1)
+ level = Z_DEFAULT_COMPRESSION;
+ else if (level < 0 || level > Z_BEST_COMPRESSION)
+ die(_("bad zlib compression level %d"), level);
+ if (!zlib_compression_seen)
+ zlib_compression_level = level;
+ if (!pack_compression_seen)
+ pack_compression_level = level;
+ return 0;
+ }
+
+ if (!strcmp(var, "core.autocrlf")) {
+ if (value && !strcasecmp(value, "input")) {
+ auto_crlf = AUTO_CRLF_INPUT;
+ return 0;
+ }
+ auto_crlf = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.safecrlf")) {
+ int eol_rndtrp_die;
+ if (value && !strcasecmp(value, "warn")) {
+ global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
+ return 0;
+ }
+ eol_rndtrp_die = git_config_bool(var, value);
+ global_conv_flags_eol = eol_rndtrp_die ?
+ CONV_EOL_RNDTRP_DIE : 0;
+ return 0;
+ }
+
+ if (!strcmp(var, "core.eol")) {
+ if (value && !strcasecmp(value, "lf"))
+ core_eol = EOL_LF;
+ else if (value && !strcasecmp(value, "crlf"))
+ core_eol = EOL_CRLF;
+ else if (value && !strcasecmp(value, "native"))
+ core_eol = EOL_NATIVE;
+ else
+ core_eol = EOL_UNSET;
+ return 0;
+ }
+
+ if (!strcmp(var, "core.checkroundtripencoding")) {
+ FREE_AND_NULL(check_roundtrip_encoding);
+ return git_config_string(&check_roundtrip_encoding, var, value);
+ }
+
+ if (!strcmp(var, "core.editor")) {
+ FREE_AND_NULL(editor_program);
+ return git_config_string(&editor_program, var, value);
+ }
+
+ if (!strcmp(var, "core.commentchar") ||
+ !strcmp(var, "core.commentstring")) {
+ if (!value)
+ return config_error_nonbool(var);
+ else if (!strcasecmp(value, "auto"))
+ auto_comment_line_char = 1;
+ else if (value[0]) {
+ if (strchr(value, '\n'))
+ return error(_("%s cannot contain newline"), var);
+ comment_line_str = value;
+ FREE_AND_NULL(comment_line_str_to_free);
+ auto_comment_line_char = 0;
+ } else
+ return error(_("%s must have at least one character"), var);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.askpass")) {
+ FREE_AND_NULL(askpass_program);
+ return git_config_string(&askpass_program, var, value);
+ }
+
+ if (!strcmp(var, "core.excludesfile")) {
+ FREE_AND_NULL(excludes_file);
+ return git_config_pathname(&excludes_file, var, value);
+ }
+
+ if (!strcmp(var, "core.whitespace")) {
+ if (!value)
+ return config_error_nonbool(var);
+ whitespace_rule_cfg = parse_whitespace_rule(value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.fsync")) {
+ if (!value)
+ return config_error_nonbool(var);
+ fsync_components = parse_fsync_components(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.fsyncmethod")) {
+ if (!value)
+ return config_error_nonbool(var);
+ if (!strcmp(value, "fsync"))
+ fsync_method = FSYNC_METHOD_FSYNC;
+ else if (!strcmp(value, "writeout-only"))
+ fsync_method = FSYNC_METHOD_WRITEOUT_ONLY;
+ else if (!strcmp(value, "batch"))
+ fsync_method = FSYNC_METHOD_BATCH;
+ else
+ warning(_("ignoring unknown core.fsyncMethod value '%s'"), value);
+
+ }
+
+ if (!strcmp(var, "core.fsyncobjectfiles")) {
+ if (fsync_object_files < 0)
+ warning(_("core.fsyncObjectFiles is deprecated; use core.fsync instead"));
+ fsync_object_files = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.createobject")) {
+ if (!value)
+ return config_error_nonbool(var);
+ if (!strcmp(value, "rename"))
+ object_creation_mode = OBJECT_CREATION_USES_RENAMES;
+ else if (!strcmp(value, "link"))
+ object_creation_mode = OBJECT_CREATION_USES_HARDLINKS;
+ else
+ die(_("invalid mode for object creation: %s"), value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.sparsecheckout")) {
+ core_apply_sparse_checkout = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.sparsecheckoutcone")) {
+ core_sparse_checkout_cone = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.precomposeunicode")) {
+ precomposed_unicode = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.protecthfs")) {
+ protect_hfs = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.protectntfs")) {
+ protect_ntfs = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.maxtreedepth")) {
+ max_allowed_tree_depth = git_config_int(var, value, ctx->kvi);
+ return 0;
+ }
+
+ /* Add other config variables here and to Documentation/config.adoc. */
+ return platform_core_config(var, value, ctx, cb);
+}
+
+static int git_default_sparse_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "sparse.expectfilesoutsideofpatterns")) {
+ sparse_expect_files_outside_of_patterns = git_config_bool(var, value);
+ return 0;
+ }
+
+ /* Add other config variables here and to Documentation/config/sparse.adoc. */
+ return 0;
+}
+
+static int git_default_i18n_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "i18n.commitencoding")) {
+ FREE_AND_NULL(git_commit_encoding);
+ return git_config_string(&git_commit_encoding, var, value);
+ }
+
+ if (!strcmp(var, "i18n.logoutputencoding")) {
+ FREE_AND_NULL(git_log_output_encoding);
+ return git_config_string(&git_log_output_encoding, var, value);
+ }
+
+ /* Add other config variables here and to Documentation/config.adoc. */
+ return 0;
+}
+
+static int git_default_branch_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "branch.autosetupmerge")) {
+ if (value && !strcmp(value, "always")) {
+ git_branch_track = BRANCH_TRACK_ALWAYS;
+ return 0;
+ } else if (value && !strcmp(value, "inherit")) {
+ git_branch_track = BRANCH_TRACK_INHERIT;
+ return 0;
+ } else if (value && !strcmp(value, "simple")) {
+ git_branch_track = BRANCH_TRACK_SIMPLE;
+ return 0;
+ }
+ git_branch_track = git_config_bool(var, value);
+ return 0;
+ }
+ if (!strcmp(var, "branch.autosetuprebase")) {
+ if (!value)
+ return config_error_nonbool(var);
+ else if (!strcmp(value, "never"))
+ autorebase = AUTOREBASE_NEVER;
+ else if (!strcmp(value, "local"))
+ autorebase = AUTOREBASE_LOCAL;
+ else if (!strcmp(value, "remote"))
+ autorebase = AUTOREBASE_REMOTE;
+ else if (!strcmp(value, "always"))
+ autorebase = AUTOREBASE_ALWAYS;
+ else
+ return error(_("malformed value for %s"), var);
+ return 0;
+ }
+
+ /* Add other config variables here and to Documentation/config.adoc. */
+ return 0;
+}
+
+static int git_default_push_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "push.default")) {
+ if (!value)
+ return config_error_nonbool(var);
+ else if (!strcmp(value, "nothing"))
+ push_default = PUSH_DEFAULT_NOTHING;
+ else if (!strcmp(value, "matching"))
+ push_default = PUSH_DEFAULT_MATCHING;
+ else if (!strcmp(value, "simple"))
+ push_default = PUSH_DEFAULT_SIMPLE;
+ else if (!strcmp(value, "upstream"))
+ push_default = PUSH_DEFAULT_UPSTREAM;
+ else if (!strcmp(value, "tracking")) /* deprecated */
+ push_default = PUSH_DEFAULT_UPSTREAM;
+ else if (!strcmp(value, "current"))
+ push_default = PUSH_DEFAULT_CURRENT;
+ else {
+ error(_("malformed value for %s: %s"), var, value);
+ return error(_("must be one of nothing, matching, simple, "
+ "upstream or current"));
+ }
+ return 0;
+ }
+
+ /* Add other config variables here and to Documentation/config.adoc. */
+ return 0;
+}
+
+static int git_default_mailmap_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "mailmap.file")) {
+ FREE_AND_NULL(git_mailmap_file);
+ return git_config_pathname(&git_mailmap_file, var, value);
+ }
+
+ if (!strcmp(var, "mailmap.blob")) {
+ FREE_AND_NULL(git_mailmap_blob);
+ return git_config_string(&git_mailmap_blob, var, value);
+ }
+
+ /* Add other config variables here and to Documentation/config.adoc. */
+ return 0;
+}
+
+static int git_default_attr_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "attr.tree")) {
+ FREE_AND_NULL(git_attr_tree);
+ return git_config_string(&git_attr_tree, var, value);
+ }
+
+ /*
+ * Add other attribute related config variables here and to
+ * Documentation/config/attr.adoc.
+ */
+ return 0;
+}
+
+int git_default_config(const char *var, const char *value,
+ const struct config_context *ctx, void *cb)
+{
+ if (starts_with(var, "core."))
+ return git_default_core_config(var, value, ctx, cb);
+
+ if (starts_with(var, "user.") ||
+ starts_with(var, "author.") ||
+ starts_with(var, "committer."))
+ return git_ident_config(var, value, ctx, cb);
+
+ if (starts_with(var, "i18n."))
+ return git_default_i18n_config(var, value);
+
+ if (starts_with(var, "branch."))
+ return git_default_branch_config(var, value);
+
+ if (starts_with(var, "push."))
+ return git_default_push_config(var, value);
+
+ if (starts_with(var, "mailmap."))
+ return git_default_mailmap_config(var, value);
+
+ if (starts_with(var, "attr."))
+ return git_default_attr_config(var, value);
+
+ if (starts_with(var, "advice.") || starts_with(var, "color.advice"))
+ return git_default_advice_config(var, value);
+
+ if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) {
+ pager_use_color = git_config_bool(var,value);
+ return 0;
+ }
+
+ if (!strcmp(var, "pack.packsizelimit")) {
+ pack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);
+ return 0;
+ }
+
+ if (!strcmp(var, "pack.compression")) {
+ int level = git_config_int(var, value, ctx->kvi);
+ if (level == -1)
+ level = Z_DEFAULT_COMPRESSION;
+ else if (level < 0 || level > Z_BEST_COMPRESSION)
+ die(_("bad pack compression level %d"), level);
+ pack_compression_level = level;
+ pack_compression_seen = 1;
+ return 0;
+ }
+
+ if (starts_with(var, "sparse."))
+ return git_default_sparse_config(var, value);
+
+ /* Add other config variables here and to Documentation/config.adoc. */
+ return 0;
+}
diff --git a/environment.h b/environment.h
index 3d806ced6e4..8cfce41015b 100644
--- a/environment.h
+++ b/environment.h
@@ -104,6 +104,9 @@ int use_optional_locks(void);
const char *get_git_namespace(void);
const char *strip_namespace(const char *namespaced_ref);
+int git_default_config(const char *, const char *,
+ const struct config_context *, void *);
+
/*
* TODO: All the below state either explicitly or implicitly relies on
* `the_repository`. We should eventually get rid of these and make the
diff --git a/fsck.c b/fsck.c
index 23965e1880f..171b424dd57 100644
--- a/fsck.c
+++ b/fsck.c
@@ -3,6 +3,7 @@
#include "git-compat-util.h"
#include "date.h"
#include "dir.h"
+#include "environment.h"
#include "hex.h"
#include "odb.h"
#include "path.h"
diff --git a/http-fetch.c b/http-fetch.c
index 17b9fe4ff8c..1922e23fcd3 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -2,6 +2,7 @@
#include "git-compat-util.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "http.h"
diff --git a/http.c b/http.c
index d94e8f63b57..33ae9429fd8 100644
--- a/http.c
+++ b/http.c
@@ -3,6 +3,7 @@
#include "git-compat-util.h"
#include "git-curl-compat.h"
+#include "environment.h"
#include "hex.h"
#include "http.h"
#include "config.h"
diff --git a/imap-send.c b/imap-send.c
index 9b26c669c01..254ec83ab78 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -28,6 +28,7 @@
#include "advice.h"
#include "config.h"
#include "credential.h"
+#include "environment.h"
#include "gettext.h"
#include "run-command.h"
#include "parse-options.h"
diff --git a/mailinfo.c b/mailinfo.c
index b4e815b2d8b..99ac596e096 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -2,6 +2,7 @@
#include "git-compat-util.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex-ll.h"
#include "utf8.h"
diff --git a/reflog.c b/reflog.c
index 39c205fd26e..a9740051346 100644
--- a/reflog.c
+++ b/reflog.c
@@ -3,6 +3,7 @@
#include "git-compat-util.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "odb.h"
diff --git a/rerere.c b/rerere.c
index c7c3e535ce5..6ec55964e2a 100644
--- a/rerere.c
+++ b/rerere.c
@@ -5,6 +5,7 @@
#include "abspath.h"
#include "config.h"
#include "copy.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "lockfile.h"
diff --git a/t/helper/test-advise.c b/t/helper/test-advise.c
index 77c15a46cfa..81ed93a05c9 100644
--- a/t/helper/test-advise.c
+++ b/t/helper/test-advise.c
@@ -3,6 +3,7 @@
#include "test-tool.h"
#include "advice.h"
#include "config.h"
+#include "environment.h"
#include "setup.h"
int cmd__advise_if_enabled(int argc, const char **argv)
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index b2da48eda05..9ae71cefb30 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -2,6 +2,7 @@
#include "test-tool.h"
#include "config.h"
+#include "environment.h"
#include "read-cache-ll.h"
#include "repository.h"
#include "setup.h"
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 0e5d38c9600..4971f722b3e 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -2,6 +2,7 @@
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
+#include "environment.h"
#include "gettext.h"
#include "config.h"
#include "hex.h"
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH 21/21] config: fix sign comparison warnings
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (19 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 20/21] config: move Git config parsing into "environment.c" Patrick Steinhardt
@ 2025-07-17 10:49 ` Patrick Steinhardt
2025-07-23 9:38 ` Phillip Wood
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
21 siblings, 1 reply; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-17 10:49 UTC (permalink / raw)
To: git
There are a couple of -Wsign-compare warnings in "config.c":
- `prepare_include_condition_pattern()` is declared to return a signed
int, but it either returns 0 or the index of the last dir separator
in a path. That index will always be positive, so the return type of
the function is changed to `size_t`, which allows us to drop a check
for `prefix < 0` at the only callsite. Furthermore, this fixes a
sign comparison warning when comparing `text.len < prefix`,
- We treat `struct config_store_data::seen` as signed integer in
several places even though it's unsigned.
- There are multiple trivial sign comparison warnings where we use a
signed loop index to iterate through an unsigned number of items.
Fix all of these issues and drop the `DISABLE_SIGN_COMPARE_WARNINGS`
macro.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
config.c | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/config.c b/config.c
index 947fba3d8d4..a530c48a048 100644
--- a/config.c
+++ b/config.c
@@ -6,8 +6,6 @@
*
*/
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "abspath.h"
#include "date.h"
@@ -197,12 +195,12 @@ static void add_trailing_starstar_for_dir(struct strbuf *pat)
strbuf_addstr(pat, "**");
}
-static int prepare_include_condition_pattern(const struct key_value_info *kvi,
- struct strbuf *pat)
+static size_t prepare_include_condition_pattern(const struct key_value_info *kvi,
+ struct strbuf *pat)
{
struct strbuf path = STRBUF_INIT;
char *expanded;
- int prefix = 0;
+ size_t prefix = 0;
expanded = interpolate_path(pat->buf, 1);
if (expanded) {
@@ -239,7 +237,8 @@ static int include_by_gitdir(const struct key_value_info *kvi,
{
struct strbuf text = STRBUF_INIT;
struct strbuf pattern = STRBUF_INIT;
- int ret = 0, prefix;
+ size_t prefix;
+ int ret = 0;
const char *git_dir;
int already_tried_absolute = 0;
@@ -253,9 +252,6 @@ static int include_by_gitdir(const struct key_value_info *kvi,
prefix = prepare_include_condition_pattern(kvi, &pattern);
again:
- if (prefix < 0)
- goto done;
-
if (prefix > 0) {
/*
* perform literal matching on the prefix part so that
@@ -724,7 +720,6 @@ int git_config_from_parameters(config_fn_t fn, void *data)
if (env) {
unsigned long count;
char *endp;
- int i;
count = strtoul(env, &endp, 10);
if (*endp) {
@@ -736,10 +731,10 @@ int git_config_from_parameters(config_fn_t fn, void *data)
goto out;
}
- for (i = 0; i < count; i++) {
+ for (unsigned long i = 0; i < count; i++) {
const char *key, *value;
- strbuf_addf(&envvar, "GIT_CONFIG_KEY_%d", i);
+ strbuf_addf(&envvar, "GIT_CONFIG_KEY_%lu", i);
key = getenv_safe(&to_free, envvar.buf);
if (!key) {
ret = error(_("missing config key %s"), envvar.buf);
@@ -747,7 +742,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)
}
strbuf_reset(&envvar);
- strbuf_addf(&envvar, "GIT_CONFIG_VALUE_%d", i);
+ strbuf_addf(&envvar, "GIT_CONFIG_VALUE_%lu", i);
value = getenv_safe(&to_free, envvar.buf);
if (!value) {
ret = error(_("missing config value %s"), envvar.buf);
@@ -1614,13 +1609,13 @@ int config_with_options(config_fn_t fn, void *data,
static void configset_iter(struct config_set *set, config_fn_t fn, void *data)
{
- int i, value_index;
+ int value_index;
struct string_list *values;
struct config_set_element *entry;
struct configset_list *list = &set->list;
struct config_context ctx = CONFIG_CONTEXT_INIT;
- for (i = 0; i < list->nr; i++) {
+ for (size_t i = 0; i < list->nr; i++) {
entry = list->items[i].e;
value_index = list->items[i].value_index;
values = &entry->value_list;
@@ -2470,10 +2465,11 @@ static ssize_t write_pair(int fd, const char *key, const char *value,
*/
static void maybe_remove_section(struct config_store_data *store,
size_t *begin_offset, size_t *end_offset,
- int *seen_ptr)
+ unsigned *seen_ptr)
{
size_t begin;
- int i, seen, section_seen = 0;
+ int section_seen = 0;
+ unsigned int i, seen;
/*
* First, ensure that this is the first key, and that there are no
@@ -2716,7 +2712,8 @@ int repo_config_set_multivar_in_file_gently(struct repository *r,
} else {
struct stat st;
size_t copy_begin, copy_end;
- int i, new_line = 0;
+ unsigned i;
+ int new_line = 0;
struct config_options opts;
if (!value_pattern)
--
2.50.1.465.gcb3da1c9e6.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* Re: [PATCH 21/21] config: fix sign comparison warnings
2025-07-17 10:49 ` [PATCH 21/21] config: fix sign comparison warnings Patrick Steinhardt
@ 2025-07-23 9:38 ` Phillip Wood
2025-07-23 13:38 ` Patrick Steinhardt
0 siblings, 1 reply; 48+ messages in thread
From: Phillip Wood @ 2025-07-23 9:38 UTC (permalink / raw)
To: Patrick Steinhardt, git
Hi Patrick
On 17/07/2025 11:49, Patrick Steinhardt wrote:
> There are a couple of -Wsign-compare warnings in "config.c":
>
> - `prepare_include_condition_pattern()` is declared to return a signed
> int, but it either returns 0 or the index of the last dir separator
> in a path.
That is not correct, the function contains the lines
if (!kvi || !kvi->path)
return error(_("relative config include "
"conditionals must come from
files"));
so a negative return value is possible.
Thanks
Phillip
> That index will always be positive, so the return type of
> the function is changed to `size_t`, which allows us to drop a check
> for `prefix < 0` at the only callsite. Furthermore, this fixes a
> sign comparison warning when comparing `text.len < prefix`,
>
> - We treat `struct config_store_data::seen` as signed integer in
> several places even though it's unsigned.
>
> - There are multiple trivial sign comparison warnings where we use a
> signed loop index to iterate through an unsigned number of items.
>
> Fix all of these issues and drop the `DISABLE_SIGN_COMPARE_WARNINGS`
> macro.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> config.c | 33 +++++++++++++++------------------
> 1 file changed, 15 insertions(+), 18 deletions(-)
>
> diff --git a/config.c b/config.c
> index 947fba3d8d4..a530c48a048 100644
> --- a/config.c
> +++ b/config.c
> @@ -6,8 +6,6 @@
> *
> */
>
> -#define DISABLE_SIGN_COMPARE_WARNINGS
> -
> #include "git-compat-util.h"
> #include "abspath.h"
> #include "date.h"
> @@ -197,12 +195,12 @@ static void add_trailing_starstar_for_dir(struct strbuf *pat)
> strbuf_addstr(pat, "**");
> }
>
> -static int prepare_include_condition_pattern(const struct key_value_info *kvi,
> - struct strbuf *pat)
> +static size_t prepare_include_condition_pattern(const struct key_value_info *kvi,
> + struct strbuf *pat)
> {
> struct strbuf path = STRBUF_INIT;
> char *expanded;
> - int prefix = 0;
> + size_t prefix = 0;
>
> expanded = interpolate_path(pat->buf, 1);
> if (expanded) {
> @@ -239,7 +237,8 @@ static int include_by_gitdir(const struct key_value_info *kvi,
> {
> struct strbuf text = STRBUF_INIT;
> struct strbuf pattern = STRBUF_INIT;
> - int ret = 0, prefix;
> + size_t prefix;
> + int ret = 0;
> const char *git_dir;
> int already_tried_absolute = 0;
>
> @@ -253,9 +252,6 @@ static int include_by_gitdir(const struct key_value_info *kvi,
> prefix = prepare_include_condition_pattern(kvi, &pattern);
>
> again:
> - if (prefix < 0)
> - goto done;
> -
> if (prefix > 0) {
> /*
> * perform literal matching on the prefix part so that
> @@ -724,7 +720,6 @@ int git_config_from_parameters(config_fn_t fn, void *data)
> if (env) {
> unsigned long count;
> char *endp;
> - int i;
>
> count = strtoul(env, &endp, 10);
> if (*endp) {
> @@ -736,10 +731,10 @@ int git_config_from_parameters(config_fn_t fn, void *data)
> goto out;
> }
>
> - for (i = 0; i < count; i++) {
> + for (unsigned long i = 0; i < count; i++) {
> const char *key, *value;
>
> - strbuf_addf(&envvar, "GIT_CONFIG_KEY_%d", i);
> + strbuf_addf(&envvar, "GIT_CONFIG_KEY_%lu", i);
> key = getenv_safe(&to_free, envvar.buf);
> if (!key) {
> ret = error(_("missing config key %s"), envvar.buf);
> @@ -747,7 +742,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)
> }
> strbuf_reset(&envvar);
>
> - strbuf_addf(&envvar, "GIT_CONFIG_VALUE_%d", i);
> + strbuf_addf(&envvar, "GIT_CONFIG_VALUE_%lu", i);
> value = getenv_safe(&to_free, envvar.buf);
> if (!value) {
> ret = error(_("missing config value %s"), envvar.buf);
> @@ -1614,13 +1609,13 @@ int config_with_options(config_fn_t fn, void *data,
>
> static void configset_iter(struct config_set *set, config_fn_t fn, void *data)
> {
> - int i, value_index;
> + int value_index;
> struct string_list *values;
> struct config_set_element *entry;
> struct configset_list *list = &set->list;
> struct config_context ctx = CONFIG_CONTEXT_INIT;
>
> - for (i = 0; i < list->nr; i++) {
> + for (size_t i = 0; i < list->nr; i++) {
> entry = list->items[i].e;
> value_index = list->items[i].value_index;
> values = &entry->value_list;
> @@ -2470,10 +2465,11 @@ static ssize_t write_pair(int fd, const char *key, const char *value,
> */
> static void maybe_remove_section(struct config_store_data *store,
> size_t *begin_offset, size_t *end_offset,
> - int *seen_ptr)
> + unsigned *seen_ptr)
> {
> size_t begin;
> - int i, seen, section_seen = 0;
> + int section_seen = 0;
> + unsigned int i, seen;
>
> /*
> * First, ensure that this is the first key, and that there are no
> @@ -2716,7 +2712,8 @@ int repo_config_set_multivar_in_file_gently(struct repository *r,
> } else {
> struct stat st;
> size_t copy_begin, copy_end;
> - int i, new_line = 0;
> + unsigned i;
> + int new_line = 0;
> struct config_options opts;
>
> if (!value_pattern)
>
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH 21/21] config: fix sign comparison warnings
2025-07-23 9:38 ` Phillip Wood
@ 2025-07-23 13:38 ` Patrick Steinhardt
0 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 13:38 UTC (permalink / raw)
To: phillip.wood; +Cc: git
On Wed, Jul 23, 2025 at 10:38:16AM +0100, Phillip Wood wrote:
> Hi Patrick
>
> On 17/07/2025 11:49, Patrick Steinhardt wrote:
> > There are a couple of -Wsign-compare warnings in "config.c":
> >
> > - `prepare_include_condition_pattern()` is declared to return a signed
> > int, but it either returns 0 or the index of the last dir separator
> > in a path.
>
> That is not correct, the function contains the lines
>
> if (!kvi || !kvi->path)
> return error(_("relative config include "
> "conditionals must come from
> files"));
>
> so a negative return value is possible.
Oh dear, I totally missed this one. Good catch, will fix in the next
version of this series. Thanks!
Patrick
^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v2 00/21] config: remove use of `the_repository`
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (20 preceding siblings ...)
2025-07-17 10:49 ` [PATCH 21/21] config: fix sign comparison warnings Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 01/21] config: drop `git_config()` wrapper Patrick Steinhardt
` (20 more replies)
21 siblings, 21 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
Hi,
this patch series removes uses of `the_repository` in "config.c". It
does this via two things:
- By removing all the wrapper functions `git_config_get()` et al that
implicitly rely on `the_repository`.
- By moving the Git-specific config parsing (that is, the non-business
logic like parsing "core.sharedRepository") into "environment.c".
This series is inspired by my painful tries yesterday to start parsing
repo settings early in the Git process lifecycle. The changes should
make it easier to eventually achieve that.
The patch series is long, but almost all of the patches are trivial as
they simply replace code like `git_config_foo(...)` with its equivalent
`repo_config_foo(the_repository, ...)`.
The series is based on top of 90c0775e972 (The eleventh batch,
2025-07-16) with bc/use-sha256-by-default-in-3.0 at c79bb70a2e7 (Enable
SHA-256 by default in breaking changes mode, 2025-07-01) merged into it
to fix a conflict with "next". There are a couple of merge conflicts
with "seen", but they are trivial to solve.
Changes in v2:
- Fix `prepare_include_condition_pattern()`.
- Link to v1: https://lore.kernel.org/r/20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im
Thanks!
Patrick
---
Patrick Steinhardt (21):
config: drop `git_config()` wrapper
config: drop `git_config_clear()` wrapper
config: drop `git_config_get()` wrapper
config: drop `git_config_get_value()` wrapper
config: drop `git_config_get_value()` wrapper
config: drop `git_config_get_string_multi()` wrapper
config: drop `git_config_get_string()` wrapper
config: drop `git_config_get_string()` wrapper
config: drop `git_config_get_int()` wrapper
config: drop `git_config_get_ulong()` wrapper
config: drop `git_config_get_bool()` wrapper
config: drop `git_config_set_in_file()` wrapper
config: drop `git_config_set_gently()` wrapper
config: drop `git_config_set()` wrapper
config: drop `git_config_set_in_file_gently()` wrapper
config: drop `git_config_set_multivar_in_file_gently()` wrapper
config: drop `git_config_get_multivar_gently()` wrapper
config: drop `git_config_set_multivar()` wrapper
config: remove unused `the_repository` wrappers
config: move Git config parsing into "environment.c"
config: fix sign comparison warnings
Documentation/user-manual.adoc | 2 +-
apply.c | 6 +-
archive-tar.c | 2 +-
archive-zip.c | 2 +-
archive.c | 4 +-
branch.c | 10 +-
builtin/add.c | 1 +
builtin/am.c | 10 +-
builtin/blame.c | 2 +-
builtin/branch.c | 8 +-
builtin/cat-file.c | 2 +-
builtin/check-attr.c | 2 +-
builtin/check-ignore.c | 3 +-
builtin/check-mailmap.c | 3 +-
builtin/checkout--worker.c | 3 +-
builtin/checkout-index.c | 1 +
builtin/checkout.c | 4 +-
builtin/clean.c | 3 +-
builtin/clone.c | 26 +-
builtin/column.c | 4 +-
builtin/commit-graph.c | 5 +-
builtin/commit-tree.c | 3 +-
builtin/commit.c | 4 +-
builtin/config.c | 60 +--
builtin/count-objects.c | 3 +-
builtin/credential-cache--daemon.c | 2 +-
builtin/credential-store.c | 2 +-
builtin/credential.c | 3 +-
builtin/describe.c | 2 +-
builtin/diff-files.c | 2 +-
builtin/diff-index.c | 2 +-
builtin/diff-tree.c | 2 +-
builtin/diff.c | 2 +-
builtin/fast-export.c | 3 +-
builtin/fast-import.c | 12 +-
builtin/fetch.c | 10 +-
builtin/fmt-merge-msg.c | 2 +-
builtin/for-each-ref.c | 1 +
builtin/fsck.c | 2 +-
builtin/fsmonitor--daemon.c | 3 +-
builtin/gc.c | 70 ++--
builtin/grep.c | 5 +-
builtin/hash-object.c | 3 +-
builtin/help.c | 5 +-
builtin/hook.c | 3 +-
builtin/index-pack.c | 2 +-
builtin/interpret-trailers.c | 3 +-
builtin/log.c | 24 +-
builtin/ls-files.c | 1 +
builtin/ls-tree.c | 3 +-
builtin/merge-base.c | 3 +-
builtin/merge-file.c | 2 +-
builtin/merge-tree.c | 3 +-
builtin/merge.c | 2 +-
builtin/mktag.c | 2 +-
builtin/multi-pack-index.c | 5 +-
builtin/mv.c | 2 +-
builtin/name-rev.c | 2 +-
builtin/notes.c | 4 +-
builtin/pack-objects.c | 2 +-
builtin/pack-refs.c | 1 +
builtin/patch-id.c | 3 +-
builtin/pull.c | 9 +-
builtin/push.c | 2 +-
builtin/range-diff.c | 2 +-
builtin/read-tree.c | 3 +-
builtin/rebase.c | 4 +-
builtin/receive-pack.c | 2 +-
builtin/reflog.c | 2 +-
builtin/refs.c | 2 +-
builtin/remote.c | 56 +--
builtin/repack.c | 2 +-
builtin/replace.c | 3 +-
builtin/rerere.c | 2 +-
builtin/reset.c | 2 +-
builtin/rev-list.c | 2 +-
builtin/rev-parse.c | 4 +-
builtin/rm.c | 3 +-
builtin/send-pack.c | 1 +
builtin/shortlog.c | 2 +-
builtin/show-branch.c | 2 +-
builtin/show-ref.c | 3 +-
builtin/sparse-checkout.c | 2 +-
builtin/stash.c | 4 +-
builtin/stripspace.c | 2 +-
builtin/submodule--helper.c | 56 +--
builtin/symbolic-ref.c | 3 +-
builtin/tag.c | 2 +-
builtin/unpack-file.c | 3 +-
builtin/unpack-objects.c | 2 +-
builtin/update-index.c | 2 +-
builtin/update-ref.c | 3 +-
builtin/update-server-info.c | 1 +
builtin/var.c | 5 +-
builtin/verify-commit.c | 1 +
builtin/verify-pack.c | 3 +-
builtin/verify-tag.c | 1 +
builtin/worktree.c | 8 +-
builtin/write-tree.c | 3 +-
checkout.c | 2 +-
commit-graph.c | 1 +
compat/precompose_utf8.c | 6 +-
config.c | 553 +------------------------
config.h | 139 -------
connect.c | 6 +-
contrib/coccinelle/config_fn_ctx.pending.cocci | 2 +-
convert.c | 2 +-
daemon.c | 2 +-
dir.c | 4 +-
editor.c | 2 +-
environment.c | 512 +++++++++++++++++++++++
environment.h | 3 +
fetch-pack.c | 16 +-
fsck.c | 1 +
fsck.h | 2 +-
fsmonitor.c | 2 +-
gpg-interface.c | 2 +-
help.c | 6 +-
http-backend.c | 6 +-
http-fetch.c | 3 +-
http.c | 3 +-
imap-send.c | 3 +-
list-objects-filter-options.c | 6 +-
ls-refs.c | 2 +-
mailinfo.c | 1 +
merge-ll.c | 2 +-
merge-ort.c | 18 +-
notes-utils.c | 2 +-
notes.c | 2 +-
parallel-checkout.c | 4 +-
pretty.c | 2 +-
promisor-remote.c | 8 +-
protocol.c | 2 +-
reachable.c | 2 +-
read-cache.c | 4 +-
rebase-interactive.c | 2 +-
reflog.c | 1 +
refs.c | 2 +-
refs/packed-backend.c | 2 +-
refs/reftable-backend.c | 2 +-
remote.c | 2 +-
rerere.c | 9 +-
revision.c | 2 +-
run-command.c | 6 +-
scalar.c | 18 +-
sequencer.c | 36 +-
setup.c | 44 +-
sideband.c | 6 +-
submodule-config.c | 2 +-
submodule.c | 2 +-
t/helper/test-advise.c | 3 +-
t/helper/test-config.c | 20 +-
t/helper/test-read-cache.c | 3 +-
t/helper/test-userdiff.c | 2 +-
t/t4256/1/mailinfo.c | 2 +-
t/t4256/1/mailinfo.c.orig | 2 +-
trailer.c | 4 +-
transport.c | 12 +-
versioncmp.c | 4 +-
worktree.c | 8 +-
xdiff-interface.c | 1 +
161 files changed, 1015 insertions(+), 1097 deletions(-)
Range-diff versus v1:
1: 1caf1bc3c2b = 1: 44ad8fd172e config: drop `git_config()` wrapper
2: e9c1afb5307 = 2: 392db3dad1a config: drop `git_config_clear()` wrapper
3: 8beb9c49e86 = 3: 31ee448c82f config: drop `git_config_get()` wrapper
4: defb931ab24 = 4: 0540beca321 config: drop `git_config_get_value()` wrapper
5: e0f662adf59 = 5: 0fd69dac496 config: drop `git_config_get_value()` wrapper
6: 16e10b9fcff = 6: 9d2aff44bf5 config: drop `git_config_get_string_multi()` wrapper
7: a4022b64c8f = 7: 34e8b394683 config: drop `git_config_get_string()` wrapper
8: 0d8ebc40ce3 = 8: 9a374f91689 config: drop `git_config_get_string()` wrapper
9: 5c06c8e2cc5 = 9: 5dd2f4682f7 config: drop `git_config_get_int()` wrapper
10: 522ff9be738 = 10: 30a338834a9 config: drop `git_config_get_ulong()` wrapper
11: 6b1a8c902d2 = 11: 3a723697ac3 config: drop `git_config_get_bool()` wrapper
12: ee9e8479b40 = 12: 176d71ab70e config: drop `git_config_set_in_file()` wrapper
13: d69766a5087 = 13: f00c8048a9a config: drop `git_config_set_gently()` wrapper
14: 25f6c2dde6d = 14: 5db30c36fca config: drop `git_config_set()` wrapper
15: 3554ad9d8bc = 15: 33a3b8ae60f config: drop `git_config_set_in_file_gently()` wrapper
16: deb51a25357 = 16: d24ab4b79e5 config: drop `git_config_set_multivar_in_file_gently()` wrapper
17: a919f54c0ec = 17: b947eb22a27 config: drop `git_config_get_multivar_gently()` wrapper
18: c8f314bdca3 = 18: e69c6d8de77 config: drop `git_config_set_multivar()` wrapper
19: 3f96884550b = 19: ff3af8ad687 config: remove unused `the_repository` wrappers
20: a21206a973d = 20: d9da8cdfd18 config: move Git config parsing into "environment.c"
21: 4630929ebca ! 21: fff5f00184c config: fix sign comparison warnings
@@ Commit message
There are a couple of -Wsign-compare warnings in "config.c":
- - `prepare_include_condition_pattern()` is declared to return a signed
- int, but it either returns 0 or the index of the last dir separator
- in a path. That index will always be positive, so the return type of
- the function is changed to `size_t`, which allows us to drop a check
- for `prefix < 0` at the only callsite. Furthermore, this fixes a
- sign comparison warning when comparing `text.len < prefix`,
+ - `prepare_include_condition_pattern()` is returns a signed integer,
+ where it either returns a negative error code or the index of the
+ last dir separator in a path. That index will always be a
+ non-negative number, but we cannot just change the return type to a
+ `size_t` due to it being re-used as error code. This is fixed by
+ splitting up concerns: the return value is only used as error code,
+ and the prefix is now returned via an out-pointer. This fixes a sign
+ comparison warning when comparing `text.len < prefix`,
- We treat `struct config_store_data::seen` as signed integer in
several places even though it's unsigned.
@@ config.c
#include "abspath.h"
#include "date.h"
@@ config.c: static void add_trailing_starstar_for_dir(struct strbuf *pat)
- strbuf_addstr(pat, "**");
}
--static int prepare_include_condition_pattern(const struct key_value_info *kvi,
+ static int prepare_include_condition_pattern(const struct key_value_info *kvi,
- struct strbuf *pat)
-+static size_t prepare_include_condition_pattern(const struct key_value_info *kvi,
-+ struct strbuf *pat)
++ struct strbuf *pat,
++ size_t *out)
{
struct strbuf path = STRBUF_INIT;
char *expanded;
@@ config.c: static void add_trailing_starstar_for_dir(struct strbuf *pat)
expanded = interpolate_path(pat->buf, 1);
if (expanded) {
+@@ config.c: static int prepare_include_condition_pattern(const struct key_value_info *kvi,
+
+ add_trailing_starstar_for_dir(pat);
+
++ *out = prefix;
++
+ strbuf_release(&path);
+- return prefix;
++ return 0;
+ }
+
+ static int include_by_gitdir(const struct key_value_info *kvi,
@@ config.c: static int include_by_gitdir(const struct key_value_info *kvi,
{
struct strbuf text = STRBUF_INIT;
@@ config.c: static int include_by_gitdir(const struct key_value_info *kvi,
int already_tried_absolute = 0;
@@ config.c: static int include_by_gitdir(const struct key_value_info *kvi,
- prefix = prepare_include_condition_pattern(kvi, &pattern);
- again:
-- if (prefix < 0)
-- goto done;
+ strbuf_realpath(&text, git_dir, 1);
+ strbuf_add(&pattern, cond, cond_len);
+- prefix = prepare_include_condition_pattern(kvi, &pattern);
-
+-again:
+- if (prefix < 0)
++ ret = prepare_include_condition_pattern(kvi, &pattern, &prefix);
++ if (ret < 0)
+ goto done;
+
++again:
if (prefix > 0) {
/*
* perform literal matching on the prefix part so that
---
base-commit: 592f97530d99d182d69c66e08279e189d006b410
change-id: 20250716-pks-config-wo-the-repository-21de9489f965
^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v2 01/21] config: drop `git_config()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 02/21] config: drop `git_config_clear()` wrapper Patrick Steinhardt
` (19 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config()`. All callsites
are adjusted so that they use `repo_config(the_repository, ...)`
instead. While some callsites might already have a repository available,
this mechanical conversion is the exact same as the current situation
and thus cannot cause any regression. Those sites should eventually be
cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/user-manual.adoc | 2 +-
apply.c | 2 +-
archive-tar.c | 2 +-
archive-zip.c | 2 +-
archive.c | 2 +-
builtin/am.c | 2 +-
builtin/blame.c | 2 +-
builtin/branch.c | 2 +-
builtin/cat-file.c | 2 +-
builtin/check-attr.c | 2 +-
builtin/check-ignore.c | 2 +-
builtin/check-mailmap.c | 2 +-
builtin/checkout--worker.c | 2 +-
builtin/checkout.c | 2 +-
builtin/clean.c | 2 +-
builtin/clone.c | 4 ++--
builtin/column.c | 4 ++--
builtin/commit-graph.c | 4 ++--
builtin/commit-tree.c | 2 +-
builtin/commit.c | 4 ++--
builtin/config.c | 2 +-
builtin/count-objects.c | 2 +-
builtin/credential.c | 2 +-
builtin/describe.c | 2 +-
builtin/diff-files.c | 2 +-
builtin/diff-index.c | 2 +-
builtin/diff-tree.c | 2 +-
builtin/diff.c | 2 +-
builtin/fast-export.c | 2 +-
builtin/fast-import.c | 2 +-
builtin/fetch.c | 4 ++--
builtin/fmt-merge-msg.c | 2 +-
builtin/fsck.c | 2 +-
builtin/fsmonitor--daemon.c | 2 +-
builtin/gc.c | 2 +-
builtin/grep.c | 2 +-
builtin/hash-object.c | 2 +-
builtin/help.c | 4 ++--
builtin/hook.c | 2 +-
builtin/index-pack.c | 2 +-
builtin/interpret-trailers.c | 2 +-
builtin/log.c | 20 ++++++++++----------
builtin/ls-tree.c | 2 +-
builtin/merge-base.c | 2 +-
builtin/merge-file.c | 2 +-
builtin/merge-tree.c | 2 +-
builtin/merge.c | 2 +-
builtin/mktag.c | 2 +-
builtin/multi-pack-index.c | 4 ++--
builtin/mv.c | 2 +-
builtin/name-rev.c | 2 +-
builtin/notes.c | 2 +-
builtin/pack-objects.c | 2 +-
builtin/patch-id.c | 2 +-
builtin/pull.c | 2 +-
builtin/push.c | 2 +-
builtin/range-diff.c | 2 +-
builtin/read-tree.c | 2 +-
builtin/rebase.c | 2 +-
builtin/receive-pack.c | 2 +-
builtin/reflog.c | 2 +-
builtin/refs.c | 2 +-
builtin/remote.c | 6 +++---
builtin/repack.c | 2 +-
builtin/replace.c | 2 +-
builtin/rerere.c | 2 +-
builtin/reset.c | 2 +-
builtin/rev-list.c | 2 +-
builtin/rev-parse.c | 4 ++--
builtin/rm.c | 2 +-
builtin/shortlog.c | 2 +-
builtin/show-branch.c | 2 +-
builtin/show-ref.c | 2 +-
builtin/sparse-checkout.c | 2 +-
builtin/stash.c | 4 ++--
builtin/stripspace.c | 2 +-
builtin/submodule--helper.c | 8 ++++----
builtin/symbolic-ref.c | 2 +-
builtin/tag.c | 2 +-
builtin/unpack-file.c | 2 +-
builtin/unpack-objects.c | 2 +-
builtin/update-index.c | 2 +-
builtin/update-ref.c | 2 +-
builtin/var.c | 4 ++--
builtin/verify-pack.c | 2 +-
builtin/worktree.c | 2 +-
builtin/write-tree.c | 2 +-
config.h | 5 -----
connect.c | 2 +-
contrib/coccinelle/config_fn_ctx.pending.cocci | 2 +-
convert.c | 2 +-
fetch-pack.c | 2 +-
fsck.h | 2 +-
gpg-interface.c | 2 +-
help.c | 4 ++--
http-fetch.c | 2 +-
http.c | 2 +-
imap-send.c | 2 +-
ls-refs.c | 2 +-
merge-ll.c | 2 +-
merge-ort.c | 2 +-
notes-utils.c | 2 +-
notes.c | 2 +-
pretty.c | 2 +-
refs/reftable-backend.c | 2 +-
rerere.c | 4 ++--
revision.c | 2 +-
scalar.c | 2 +-
sequencer.c | 2 +-
setup.c | 4 ++--
t/helper/test-advise.c | 2 +-
t/helper/test-config.c | 8 ++++----
t/helper/test-read-cache.c | 2 +-
t/helper/test-userdiff.c | 2 +-
t/t4256/1/mailinfo.c | 2 +-
t/t4256/1/mailinfo.c.orig | 2 +-
trailer.c | 4 ++--
transport.c | 2 +-
118 files changed, 148 insertions(+), 153 deletions(-)
diff --git a/Documentation/user-manual.adoc b/Documentation/user-manual.adoc
index 8d00a9e8229..76969871176 100644
--- a/Documentation/user-manual.adoc
+++ b/Documentation/user-manual.adoc
@@ -4270,7 +4270,7 @@ So, look into `builtin/cat-file.c`, search for `cmd_cat_file()` and look what
it does.
------------------------------------------------------------------
- git_config(git_default_config);
+ repo_config(the_repository, git_default_config);
if (argc != 3)
usage("git cat-file [-t|-s|-e|-p|<type>] <sha1>");
if (get_sha1(argv[2], sha1))
diff --git a/apply.c b/apply.c
index a3804316fbd..d2381a157c0 100644
--- a/apply.c
+++ b/apply.c
@@ -50,7 +50,7 @@ static void git_apply_config(void)
{
git_config_get_string("apply.whitespace", &apply_default_whitespace);
git_config_get_string("apply.ignorewhitespace", &apply_default_ignorewhitespace);
- git_config(git_xmerge_config, NULL);
+ repo_config(the_repository, git_xmerge_config, NULL);
}
static int parse_whitespace_option(struct apply_state *state, const char *option)
diff --git a/archive-tar.c b/archive-tar.c
index 249164ea77d..73b63ddc41b 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -537,7 +537,7 @@ void init_tar_archiver(void)
tar_filter_config("tar.tgz.remote", "true", NULL);
tar_filter_config("tar.tar.gz.command", internal_gzip_command, NULL);
tar_filter_config("tar.tar.gz.remote", "true", NULL);
- git_config(git_tar_config, NULL);
+ repo_config(the_repository, git_tar_config, NULL);
for (i = 0; i < nr_tar_filters; i++) {
/* omit any filters that never had a command configured */
if (tar_filters[i]->filter_command)
diff --git a/archive-zip.c b/archive-zip.c
index df8866d5bae..dbd90d9c3d4 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -632,7 +632,7 @@ static int write_zip_archive(const struct archiver *ar UNUSED,
{
int err;
- git_config(archive_zip_config, NULL);
+ repo_config(the_repository, archive_zip_config, NULL);
dos_time(&args->time, &zip_date, &zip_time);
diff --git a/archive.c b/archive.c
index f5a9d45c8d3..2dd306a07a7 100644
--- a/archive.c
+++ b/archive.c
@@ -761,7 +761,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
int rc;
git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
describe_status.max_invocations = 1;
ctx.date_mode.type = DATE_NORMAL;
diff --git a/builtin/am.c b/builtin/am.c
index c9d925f7b96..a7e7cf1465a 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -2445,7 +2445,7 @@ int cmd_am(int argc,
show_usage_with_options_if_asked(argc, argv, usage, options);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
am_state_init(&state);
diff --git a/builtin/blame.c b/builtin/blame.c
index 91586e6852b..71efeb7c7e6 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -947,7 +947,7 @@ int cmd_blame(int argc,
const char *const *opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage;
setup_default_color_by_age();
- git_config(git_blame_config, &output_option);
+ repo_config(the_repository, git_blame_config, &output_option);
repo_init_revisions(the_repository, &revs, NULL);
revs.date_mode = blame_date_mode;
revs.diffopt.flags.allow_textconv = 1;
diff --git a/builtin/branch.c b/builtin/branch.c
index c150131bd9f..08e50bf77b3 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -791,7 +791,7 @@ int cmd_branch(int argc,
* Try to set sort keys from config. If config does not set any,
* fall back on default (refname) sorting.
*/
- git_config(git_branch_config, &sorting_options);
+ repo_config(the_repository, git_branch_config, &sorting_options);
if (!sorting_options.nr)
string_list_append(&sorting_options, "refname");
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 2492a0b6f39..b9eb2bb3b92 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -1095,7 +1095,7 @@ int cmd_cat_file(int argc,
OPT_END()
};
- git_config(git_cat_file_config, NULL);
+ repo_config(the_repository, git_cat_file_config, NULL);
batch.buffer_output = -1;
diff --git a/builtin/check-attr.c b/builtin/check-attr.c
index 7cf275b8937..51ed48ce437 100644
--- a/builtin/check-attr.c
+++ b/builtin/check-attr.c
@@ -119,7 +119,7 @@ int cmd_check_attr(int argc,
if (!is_bare_repository())
setup_work_tree();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, check_attr_options,
check_attr_usage, PARSE_OPT_KEEP_DASHDASH);
diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c
index 7b7831d13a8..03033499cb0 100644
--- a/builtin/check-ignore.c
+++ b/builtin/check-ignore.c
@@ -159,7 +159,7 @@ int cmd_check_ignore(int argc,
int num_ignored;
struct dir_struct dir = DIR_INIT;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, check_ignore_options,
check_ignore_usage, 0);
diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c
index be2cebe1215..634626c6728 100644
--- a/builtin/check-mailmap.c
+++ b/builtin/check-mailmap.c
@@ -56,7 +56,7 @@ int cmd_check_mailmap(int argc,
int i;
struct string_list mailmap = STRING_LIST_INIT_NODUP;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, check_mailmap_options,
check_mailmap_usage, 0);
if (argc == 0 && !use_stdin)
diff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c
index da9345a44b8..27a7d4f0409 100644
--- a/builtin/checkout--worker.c
+++ b/builtin/checkout--worker.c
@@ -132,7 +132,7 @@ int cmd_checkout__worker(int argc,
checkout_worker_usage,
checkout_worker_options);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, checkout_worker_options,
checkout_worker_usage, 0);
if (argc > 0)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 0a90b86a729..948ff7bdda7 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1764,7 +1764,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
opts->prefix = prefix;
opts->show_progress = -1;
- git_config(git_checkout_config, opts);
+ repo_config(the_repository, git_checkout_config, opts);
if (the_repository->gitdir) {
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/clean.c b/builtin/clean.c
index 053c94fc6bd..5ee147c4acc 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -949,7 +949,7 @@ int cmd_clean(int argc,
OPT_END()
};
- git_config(git_clean_config, NULL);
+ repo_config(the_repository, git_clean_config, NULL);
argc = parse_options(argc, argv, prefix, options, builtin_clean_usage,
0);
diff --git a/builtin/clone.c b/builtin/clone.c
index 6d08abed37c..3c6d8529b6c 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -1001,7 +1001,7 @@ int cmd_clone(int argc,
packet_trace_identity("clone");
- git_config(git_clone_config, NULL);
+ repo_config(the_repository, git_clone_config, NULL);
argc = parse_options(argc, argv, prefix, builtin_clone_options,
builtin_clone_usage, 0);
@@ -1242,7 +1242,7 @@ int cmd_clone(int argc,
* re-read config after init_db and write_config to pick up any config
* injected by --template and --config, respectively.
*/
- git_config(git_clone_config, NULL);
+ repo_config(the_repository, git_clone_config, NULL);
/*
* If option_reject_shallow is specified from CLI option,
diff --git a/builtin/column.c b/builtin/column.c
index ce6443d5fac..87dce3c6e53 100644
--- a/builtin/column.c
+++ b/builtin/column.c
@@ -42,9 +42,9 @@ int cmd_column(int argc,
/* This one is special and must be the first one */
if (argc > 1 && starts_with(argv[1], "--command=")) {
command = argv[1] + 10;
- git_config(column_config, (void *)command);
+ repo_config(the_repository, column_config, (void *)command);
} else
- git_config(column_config, NULL);
+ repo_config(the_repository, column_config, NULL);
memset(&copts, 0, sizeof(copts));
copts.padding = 1;
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index 25018a0b9df..c5cc601844c 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -265,7 +265,7 @@ static int graph_write(int argc, const char **argv, const char *prefix,
trace2_cmd_mode("write");
- git_config(git_commit_graph_write_config, &opts);
+ repo_config(the_repository, git_commit_graph_write_config, &opts);
argc = parse_options(argc, argv, prefix,
options,
@@ -347,7 +347,7 @@ int cmd_commit_graph(int argc,
};
struct option *options = parse_options_concat(builtin_commit_graph_options, common_opts);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
disable_replace_refs();
save_commit_buffer = 0;
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index 31cfd9bd15d..2f1df28d413 100644
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
@@ -125,7 +125,7 @@ int cmd_commit_tree(int argc,
};
int ret;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
show_usage_with_options_if_asked(argc, argv,
commit_tree_usage, options);
diff --git a/builtin/commit.c b/builtin/commit.c
index fba0dded64a..fcd829e04ec 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -207,9 +207,9 @@ static void status_init_config(struct wt_status *s, config_fn_t fn)
{
wt_status_prepare(the_repository, s);
init_diff_ui_defaults();
- git_config(fn, s);
+ repo_config(the_repository, fn, s);
determine_whence(s);
- s->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after git_config() */
+ s->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after repo_config() */
}
static void rollback_index_files(void)
diff --git a/builtin/config.c b/builtin/config.c
index 5efe2730106..af5d79eadc0 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -1091,7 +1091,7 @@ static int show_editor(struct config_location_options *opts)
die(_("editing stdin is not supported"));
if (opts->source.blob)
die(_("editing blobs is not supported"));
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
config_file = opts->source.file ?
xstrdup(opts->source.file) :
repo_git_path(the_repository, "config");
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index f687647931e..433daff805a 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -106,7 +106,7 @@ int cmd_count_objects(int argc,
OPT_END(),
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, opts, count_objects_usage, 0);
/* we do not take arguments other than flags for now */
diff --git a/builtin/credential.c b/builtin/credential.c
index 2e11b15dde3..52f172e80cb 100644
--- a/builtin/credential.c
+++ b/builtin/credential.c
@@ -16,7 +16,7 @@ int cmd_credential(int argc,
const char *op;
struct credential c = CREDENTIAL_INIT;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
show_usage_if_asked(argc, argv, usage_msg);
if (argc != 2)
diff --git a/builtin/describe.c b/builtin/describe.c
index fbf305d7624..d7dd8139dec 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -623,7 +623,7 @@ int cmd_describe(int argc,
OPT_END(),
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, describe_usage, 0);
if (abbrev < 0)
abbrev = DEFAULT_ABBREV;
diff --git a/builtin/diff-files.c b/builtin/diff-files.c
index 99b1749723b..ea91347ce23 100644
--- a/builtin/diff-files.c
+++ b/builtin/diff-files.c
@@ -31,7 +31,7 @@ int cmd_diff_files(int argc,
show_usage_if_asked(argc, argv, diff_files_usage);
- git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
+ repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/diff-index.c b/builtin/diff-index.c
index 81c0bc8ed7c..522dacfc4cf 100644
--- a/builtin/diff-index.c
+++ b/builtin/diff-index.c
@@ -28,7 +28,7 @@ int cmd_diff_index(int argc,
show_usage_if_asked(argc, argv, diff_cache_usage);
- git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
+ repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index e31cc797fe1..49dd4d00ebf 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -124,7 +124,7 @@ int cmd_diff_tree(int argc,
show_usage_if_asked(argc, argv, diff_tree_usage);
- git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
+ repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/diff.c b/builtin/diff.c
index eebffe36ccf..9a89e25a982 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -486,7 +486,7 @@ int cmd_diff(int argc,
repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);
init_diff_ui_defaults();
- git_config(git_diff_ui_config, NULL);
+ repo_config(the_repository, git_diff_ui_config, NULL);
prefix = precompose_argv_prefix(argc, argv, prefix);
repo_init_revisions(the_repository, &rev, prefix);
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 6a3a17a8cd9..17027b859e0 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -1327,7 +1327,7 @@ int cmd_fast_export(int argc,
usage_with_options (fast_export_usage, options);
/* we handle encodings */
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
repo_init_revisions(the_repository, &revs, prefix);
init_revision_sources(&revision_sources);
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index b1389c59211..607441e921b 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -3541,7 +3541,7 @@ static void git_pack_config(void)
else if (!git_config_get_int("transfer.unpacklimit", &limit))
unpack_limit = limit;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
}
static const char fast_import_usage[] =
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 87a0cca7994..ea447c453d1 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1995,7 +1995,7 @@ static int add_remote_or_group(const char *name, struct string_list *list)
struct remote_group_data g;
g.name = name; g.list = list;
- git_config(get_remote_group, &g);
+ repo_config(the_repository, get_remote_group, &g);
if (list->nr == prev_nr) {
struct remote *remote = remote_get(name);
if (!remote_is_configured(remote, 0))
@@ -2417,7 +2417,7 @@ int cmd_fetch(int argc,
free(anon);
}
- git_config(git_fetch_config, &config);
+ repo_config(the_repository, git_fetch_config, &config);
if (the_repository->gitdir) {
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 3b6aac2cf7f..edb93c0b3a3 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -53,7 +53,7 @@ int cmd_fmt_merge_msg(int argc,
int ret;
struct fmt_merge_msg_opts opts;
- git_config(fmt_merge_msg_config, NULL);
+ repo_config(the_repository, fmt_merge_msg_config, NULL);
argc = parse_options(argc, argv, prefix, options, fmt_merge_msg_usage,
0);
if (argc > 0)
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 0084cf7400b..0ec6ca06e3b 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -987,7 +987,7 @@ int cmd_fsck(int argc,
if (name_objects)
fsck_enable_object_names(&fsck_walk_options);
- git_config(git_fsck_config, &fsck_obj_options);
+ repo_config(the_repository, git_fsck_config, &fsck_obj_options);
prepare_repo_settings(the_repository);
if (check_references)
diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c
index 0820e524f1a..469c62b555b 100644
--- a/builtin/fsmonitor--daemon.c
+++ b/builtin/fsmonitor--daemon.c
@@ -1547,7 +1547,7 @@ int cmd_fsmonitor__daemon(int argc,
OPT_END()
};
- git_config(fsmonitor_config, NULL);
+ repo_config(the_repository, fsmonitor_config, NULL);
argc = parse_options(argc, argv, prefix, options,
builtin_fsmonitor__daemon_usage, 0);
diff --git a/builtin/gc.c b/builtin/gc.c
index fab8f4dd4f7..d9e3b9d2ec3 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -228,7 +228,7 @@ static void gc_config(struct gc_config *cfg)
cfg->repack_filter_to = owned;
}
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
}
enum schedule_priority {
diff --git a/builtin/grep.c b/builtin/grep.c
index 39273d9c0fd..7982dda9a3b 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -1035,7 +1035,7 @@ int cmd_grep(int argc,
grep_prefix = prefix;
grep_init(&opt, the_repository);
- git_config(grep_cmd_config, &opt);
+ repo_config(the_repository, grep_cmd_config, &opt);
/*
* If there is no -- then the paths must exist in the working
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index ddf281413a6..c3ad1e91c96 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -111,7 +111,7 @@ int cmd_hash_object(int argc,
vpath = vpath_free;
}
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
if (stdin_paths) {
if (hashstdin)
diff --git a/builtin/help.c b/builtin/help.c
index c257079cebc..d79ecd946a6 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -210,7 +210,7 @@ static enum help_format parse_help_format(const char *format)
if (!strcmp(format, "web") || !strcmp(format, "html"))
return HELP_FORMAT_WEB;
/*
- * Please update _git_config() in git-completion.bash when you
+ * Please update _repo_config() in git-completion.bash when you
* add new help formats.
*/
die(_("unrecognized help format '%s'"), format);
@@ -706,7 +706,7 @@ int cmd_help(int argc,
}
setup_git_directory_gently(&nongit);
- git_config(git_help_config, NULL);
+ repo_config(the_repository, git_help_config, NULL);
if (parsed_help_format != HELP_FORMAT_NONE)
help_format = parsed_help_format;
diff --git a/builtin/hook.c b/builtin/hook.c
index 672d2e37e84..044c27aa95d 100644
--- a/builtin/hook.c
+++ b/builtin/hook.c
@@ -55,7 +55,7 @@ static int run(int argc, const char **argv, const char *prefix,
strvec_push(&opt.args, argv[i]);
/* Need to take into account core.hooksPath */
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
hook_name = argv[0];
if (!ignore_missing)
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 0a5c8a1ac85..53f1a7cd71e 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1917,7 +1917,7 @@ int cmd_index_pack(int argc,
reset_pack_idx_option(&opts);
opts.flags |= WRITE_REV;
- git_config(git_index_pack_config, &opts);
+ repo_config(the_repository, git_index_pack_config, &opts);
if (prefix && chdir(prefix))
die(_("Cannot come back to cwd"));
diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c
index 44d8ccddc9d..3141c37b853 100644
--- a/builtin/interpret-trailers.c
+++ b/builtin/interpret-trailers.c
@@ -220,7 +220,7 @@ int cmd_interpret_trailers(int argc,
OPT_END()
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options,
git_interpret_trailers_usage, 0);
diff --git a/builtin/log.c b/builtin/log.c
index 24a57c20a41..1bedc4ef355 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -659,10 +659,10 @@ int cmd_whatchanged(int argc,
log_config_init(&cfg);
init_diff_ui_defaults();
- git_config(git_log_config, &cfg);
+ repo_config(the_repository, git_log_config, &cfg);
repo_init_revisions(the_repository, &rev, prefix);
- git_config(grep_config, &rev.grep_filter);
+ repo_config(the_repository, grep_config, &rev.grep_filter);
rev.diff = 1;
rev.simplify_history = 0;
@@ -790,7 +790,7 @@ int cmd_show(int argc,
log_config_init(&cfg);
init_diff_ui_defaults();
- git_config(git_log_config, &cfg);
+ repo_config(the_repository, git_log_config, &cfg);
if (the_repository->gitdir) {
prepare_repo_settings(the_repository);
@@ -799,7 +799,7 @@ int cmd_show(int argc,
memset(&match_all, 0, sizeof(match_all));
repo_init_revisions(the_repository, &rev, prefix);
- git_config(grep_config, &rev.grep_filter);
+ repo_config(the_repository, grep_config, &rev.grep_filter);
rev.diff = 1;
rev.always_show_header = 1;
@@ -907,11 +907,11 @@ int cmd_log_reflog(int argc,
log_config_init(&cfg);
init_diff_ui_defaults();
- git_config(git_log_config, &cfg);
+ repo_config(the_repository, git_log_config, &cfg);
repo_init_revisions(the_repository, &rev, prefix);
init_reflog_walk(&rev.reflog_info);
- git_config(grep_config, &rev.grep_filter);
+ repo_config(the_repository, grep_config, &rev.grep_filter);
rev.verbose_header = 1;
memset(&opt, 0, sizeof(opt));
@@ -952,10 +952,10 @@ int cmd_log(int argc,
log_config_init(&cfg);
init_diff_ui_defaults();
- git_config(git_log_config, &cfg);
+ repo_config(the_repository, git_log_config, &cfg);
repo_init_revisions(the_repository, &rev, prefix);
- git_config(grep_config, &rev.grep_filter);
+ repo_config(the_repository, grep_config, &rev.grep_filter);
rev.always_show_header = 1;
memset(&opt, 0, sizeof(opt));
@@ -2158,9 +2158,9 @@ int cmd_format_patch(int argc,
format_config_init(&cfg);
init_diff_ui_defaults();
init_display_notes(&cfg.notes_opt);
- git_config(git_format_config, &cfg);
+ repo_config(the_repository, git_format_config, &cfg);
repo_init_revisions(the_repository, &rev, prefix);
- git_config(grep_config, &rev.grep_filter);
+ repo_config(the_repository, grep_config, &rev.grep_filter);
rev.show_notes = cfg.show_notes;
memcpy(&rev.notes_opt, &cfg.notes_opt, sizeof(cfg.notes_opt));
diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c
index 4d616dd5282..4ba84e51967 100644
--- a/builtin/ls-tree.c
+++ b/builtin/ls-tree.c
@@ -375,7 +375,7 @@ int cmd_ls_tree(int argc,
struct object_context obj_context = {0};
int ret;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, ls_tree_options,
ls_tree_usage, 0);
diff --git a/builtin/merge-base.c b/builtin/merge-base.c
index 123c81515e1..8fde35c1751 100644
--- a/builtin/merge-base.c
+++ b/builtin/merge-base.c
@@ -167,7 +167,7 @@ int cmd_merge_base(int argc,
OPT_END()
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0);
if (cmdmode == 'a') {
diff --git a/builtin/merge-file.c b/builtin/merge-file.c
index 9464f275629..3da4ca2c8cf 100644
--- a/builtin/merge-file.c
+++ b/builtin/merge-file.c
@@ -97,7 +97,7 @@ int cmd_merge_file(int argc,
if (startup_info->have_repository) {
/* Read the configuration file */
- git_config(git_xmerge_config, NULL);
+ repo_config(the_repository, git_xmerge_config, NULL);
if (0 <= git_xmerge_style)
xmp.style = git_xmerge_style;
}
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index cf8b06cadc7..99a6495fd52 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -683,7 +683,7 @@ int cmd_merge_tree(int argc,
if (argc != expected_remaining_argc)
usage_with_options(merge_tree_usage, mt_options);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
/* Do the relevant type of merge */
if (o.mode == MODE_REAL)
diff --git a/builtin/merge.c b/builtin/merge.c
index 18b22c0a26d..dc4cb8fb14d 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1392,7 +1392,7 @@ int cmd_merge(int argc,
skip_prefix(branch, "refs/heads/", &branch);
init_diff_ui_defaults();
- git_config(git_merge_config, NULL);
+ repo_config(the_repository, git_merge_config, NULL);
if (!branch || is_null_oid(&head_oid))
head_commit = NULL;
diff --git a/builtin/mktag.c b/builtin/mktag.c
index 27e649736cf..e078c97d032 100644
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
@@ -98,7 +98,7 @@ int cmd_mktag(int argc,
fsck_set_msg_type_from_ids(&fsck_options, FSCK_MSG_EXTRA_HEADER_ENTRY,
FSCK_WARN);
/* config might set fsck.extraHeaderEntry=* again */
- git_config(git_fsck_config, &fsck_options);
+ repo_config(the_repository, git_fsck_config, &fsck_options);
if (fsck_tag_standalone(NULL, buf.buf, buf.len, &fsck_options,
&tagged_oid, &tagged_type))
die(_("tag on stdin did not pass our strict fsck check"));
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index aa25b06f9d0..9a113f0f1f3 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -143,7 +143,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;
- git_config(git_multi_pack_index_write_config, NULL);
+ repo_config(the_repository, git_multi_pack_index_write_config, NULL);
options = add_common_options(builtin_multi_pack_index_write_options);
@@ -290,7 +290,7 @@ int cmd_multi_pack_index(int argc,
disable_replace_refs();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
if (the_repository &&
the_repository->objects &&
diff --git a/builtin/mv.c b/builtin/mv.c
index 07548fe96ae..d43925097b4 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -239,7 +239,7 @@ int cmd_mv(int argc,
struct strbuf pathbuf = STRBUF_INIT;
int ret;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, builtin_mv_options,
builtin_mv_usage, 0);
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index ff199638dee..74512e54a38 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -600,7 +600,7 @@ int cmd_name_rev(int argc,
mem_pool_init(&string_pool, 0);
init_commit_rev_name(&rev_names);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0);
#ifndef WITH_BREAKING_CHANGES
diff --git a/builtin/notes.c b/builtin/notes.c
index a9529b1696a..17004cdb10e 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -1145,7 +1145,7 @@ int cmd_notes(int argc,
OPT_END()
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, git_notes_usage,
PARSE_OPT_SUBCOMMAND_OPTIONAL);
if (!fn) {
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 5781dec9808..8c86ec2d89f 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -4924,7 +4924,7 @@ int cmd_pack_objects(int argc,
reset_pack_idx_option(&pack_idx_opts);
pack_idx_opts.flags |= WRITE_REV;
- git_config(git_pack_config, NULL);
+ repo_config(the_repository, git_pack_config, NULL);
if (git_env_bool(GIT_TEST_NO_WRITE_REV_INDEX, 0))
pack_idx_opts.flags &= ~WRITE_REV;
diff --git a/builtin/patch-id.c b/builtin/patch-id.c
index 26f04b0335d..a659f00531a 100644
--- a/builtin/patch-id.c
+++ b/builtin/patch-id.c
@@ -235,7 +235,7 @@ int cmd_patch_id(int argc,
OPT_END()
};
- git_config(git_patch_id_config, &config);
+ repo_config(the_repository, git_patch_id_config, &config);
/* verbatim implies stable */
if (config.verbatim)
diff --git a/builtin/pull.c b/builtin/pull.c
index c593f324fe7..d13ed9b5176 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -999,7 +999,7 @@ int cmd_pull(int argc,
if (!getenv("GIT_REFLOG_ACTION"))
set_reflog_message(argc, argv);
- git_config(git_pull_config, NULL);
+ repo_config(the_repository, git_pull_config, NULL);
if (the_repository->gitdir) {
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/push.c b/builtin/push.c
index 92d530e5c4d..d0794b7b305 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -598,7 +598,7 @@ int cmd_push(int argc,
};
packet_trace_identity("push");
- git_config(git_push_config, &flags);
+ repo_config(the_repository, git_push_config, &flags);
argc = parse_options(argc, argv, prefix, options, push_usage, 0);
push_options = (push_options_cmdline.nr
? &push_options_cmdline
diff --git a/builtin/range-diff.c b/builtin/range-diff.c
index 32ddb6613fb..a563abff5fe 100644
--- a/builtin/range-diff.c
+++ b/builtin/range-diff.c
@@ -54,7 +54,7 @@ int cmd_range_diff(int argc,
struct object_id oid;
const char *three_dots = NULL;
- git_config(git_diff_ui_config, NULL);
+ repo_config(the_repository, git_diff_ui_config, NULL);
repo_diff_setup(the_repository, &diffopt);
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index a8f352f7cd9..00eef756e67 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -168,7 +168,7 @@ int cmd_read_tree(int argc,
opts.src_index = the_repository->index;
opts.dst_index = the_repository->index;
- git_config(git_read_tree_config, NULL);
+ repo_config(the_repository, git_read_tree_config, NULL);
argc = parse_options(argc, argv, cmd_prefix, read_tree_options,
read_tree_usage, 0);
diff --git a/builtin/rebase.c b/builtin/rebase.c
index e90562a3b8a..0c3daa4b814 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1245,7 +1245,7 @@ int cmd_rebase(int argc,
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
- git_config(rebase_config, &options);
+ repo_config(the_repository, rebase_config, &options);
/* options.gpg_sign_opt will be either "-S" or NULL */
gpg_sign = options.gpg_sign_opt ? "" : NULL;
FREE_AND_NULL(options.gpg_sign_opt);
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 7974d157eb9..82d516a42c4 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -2613,7 +2613,7 @@ int cmd_receive_pack(int argc,
if (!enter_repo(service_dir, 0))
die("'%s' does not appear to be a git repository", service_dir);
- git_config(receive_pack_config, NULL);
+ repo_config(the_repository, receive_pack_config, NULL);
if (cert_nonce_seed)
push_cert_nonce = prepare_push_cert_nonce(service_dir, time(NULL));
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 3acaf3e32c2..4312f3d34c9 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -202,7 +202,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix,
OPT_END()
};
- git_config(reflog_expire_config, &opts);
+ repo_config(the_repository, reflog_expire_config, &opts);
save_commit_buffer = 0;
do_all = status = 0;
diff --git a/builtin/refs.c b/builtin/refs.c
index 998d2a2c1cc..c7ad0a2963a 100644
--- a/builtin/refs.c
+++ b/builtin/refs.c
@@ -88,7 +88,7 @@ static int cmd_refs_verify(int argc, const char **argv, const char *prefix,
if (argc)
usage(_("'git refs verify' takes no arguments"));
- git_config(git_fsck_config, &fsck_refs_options);
+ repo_config(the_repository, git_fsck_config, &fsck_refs_options);
prepare_repo_settings(the_repository);
worktrees = get_worktrees_without_reading_head();
diff --git a/builtin/remote.c b/builtin/remote.c
index 18843b6bf6c..ebd70bea3a1 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -353,7 +353,7 @@ static void read_branches(void)
{
if (branch_list.nr)
return;
- git_config(config_read_branches, NULL);
+ repo_config(the_repository, config_read_branches, NULL);
}
struct ref_states {
@@ -690,7 +690,7 @@ static void handle_push_default(const char* old_name, const char* new_name)
.origin = STRBUF_INIT,
.linenr = -1,
};
- git_config(config_read_push_default, &push_default);
+ repo_config(the_repository, config_read_push_default, &push_default);
if (push_default.scope >= CONFIG_SCOPE_COMMAND)
; /* pass */
else if (push_default.scope >= CONFIG_SCOPE_LOCAL) {
@@ -1620,7 +1620,7 @@ static int update(int argc, const char **argv, const char *prefix,
strvec_push(&cmd.args, argv[i]);
if (strcmp(cmd.args.v[cmd.args.nr-1], "default") == 0) {
- git_config(get_remote_default, &default_defined);
+ repo_config(the_repository, get_remote_default, &default_defined);
if (!default_defined) {
strvec_pop(&cmd.args);
strvec_push(&cmd.args, "--all");
diff --git a/builtin/repack.c b/builtin/repack.c
index b05ffe46239..dd1db282dac 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -1230,7 +1230,7 @@ int cmd_repack(int argc,
list_objects_filter_init(&po_args.filter_options);
- git_config(repack_config, &cruft_po_args);
+ repo_config(the_repository, repack_config, &cruft_po_args);
argc = parse_options(argc, argv, prefix, builtin_repack_options,
git_repack_usage, 0);
diff --git a/builtin/replace.c b/builtin/replace.c
index 5ff2ab723cb..3fe39e9df73 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -574,7 +574,7 @@ int cmd_replace(int argc,
};
disable_replace_refs();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0);
diff --git a/builtin/rerere.c b/builtin/rerere.c
index 1312e79d89f..a056cb791b4 100644
--- a/builtin/rerere.c
+++ b/builtin/rerere.c
@@ -66,7 +66,7 @@ int cmd_rerere(int argc,
argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
- git_config(git_xmerge_config, NULL);
+ repo_config(the_repository, git_xmerge_config, NULL);
if (autoupdate == 1)
flags = RERERE_AUTOUPDATE;
diff --git a/builtin/reset.c b/builtin/reset.c
index dc50ffc1ac5..00492c19b06 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -377,7 +377,7 @@ int cmd_reset(int argc,
OPT_END()
};
- git_config(git_reset_config, NULL);
+ repo_config(the_repository, git_reset_config, NULL);
argc = parse_options(argc, argv, prefix, options, git_reset_usage,
PARSE_OPT_KEEP_DASHDASH);
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 4d0c460f186..034ea0a558a 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -636,7 +636,7 @@ int cmd_rev_list(int argc,
show_usage_if_asked(argc, argv, rev_list_usage);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
repo_init_revisions(the_repository, &revs, prefix);
revs.abbrev = DEFAULT_ABBREV;
revs.commit_format = CMIT_FMT_UNSPECIFIED;
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 490da33becc..44ff1b8342a 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -734,7 +734,7 @@ int cmd_rev_parse(int argc,
/* No options; just report on whether we're in a git repo or not. */
if (argc == 1) {
setup_git_directory();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
return 0;
}
@@ -769,7 +769,7 @@ int cmd_rev_parse(int argc,
/* The rest of the options require a git repository. */
if (!did_repo_setup) {
prefix = setup_git_directory();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
did_repo_setup = 1;
prepare_repo_settings(the_repository);
diff --git a/builtin/rm.c b/builtin/rm.c
index a6565a69cfc..8c0da7a3ce7 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -271,7 +271,7 @@ int cmd_rm(int argc,
struct pathspec pathspec;
char *seen;
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, builtin_rm_options,
builtin_rm_usage, 0);
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 60adc5e7a56..b91acf45c8f 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -421,7 +421,7 @@ int cmd_shortlog(int argc,
if (nongit && !the_hash_algo)
repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
shortlog_init(&log);
repo_init_revisions(the_repository, &rev, prefix);
parse_options_start(&ctx, argc, argv, prefix, options,
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 525b231d87e..1ab7db9d2ca 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -710,7 +710,7 @@ int cmd_show_branch(int ac,
init_commit_name_slab(&name_slab);
- git_config(git_show_branch_config, NULL);
+ repo_config(the_repository, git_show_branch_config, NULL);
/* If nothing is specified, try the default first */
if (ac == 1 && default_args.nr) {
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 117709cb076..414e55b92d5 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -324,7 +324,7 @@ struct repository *repo UNUSED)
OPT_END()
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, show_ref_options,
show_ref_usage, 0);
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
index 1bf01591b27..8c333b3e2e1 100644
--- a/builtin/sparse-checkout.c
+++ b/builtin/sparse-checkout.c
@@ -1082,7 +1082,7 @@ int cmd_sparse_checkout(int argc,
builtin_sparse_checkout_options,
builtin_sparse_checkout_usage, 0);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/stash.c b/builtin/stash.c
index e2f95cc2ebc..821b58a14e5 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -979,7 +979,7 @@ static int show_stash(int argc, const char **argv, const char *prefix,
int do_usage = 0;
init_diff_ui_defaults();
- git_config(git_diff_ui_config, NULL);
+ repo_config(the_repository, git_diff_ui_config, NULL);
repo_init_revisions(the_repository, &rev, prefix);
argc = parse_options(argc, argv, prefix, options, git_stash_show_usage,
@@ -2358,7 +2358,7 @@ int cmd_stash(int argc,
const char **args_copy;
int ret;
- git_config(git_stash_config, NULL);
+ repo_config(the_repository, git_stash_config, NULL);
argc = parse_options(argc, argv, prefix, options, git_stash_usage,
PARSE_OPT_SUBCOMMAND_OPTIONAL |
diff --git a/builtin/stripspace.c b/builtin/stripspace.c
index e147f3ff92c..4a566cbc5de 100644
--- a/builtin/stripspace.c
+++ b/builtin/stripspace.c
@@ -55,7 +55,7 @@ int cmd_stripspace(int argc,
if (mode == STRIP_COMMENTS || mode == COMMENT_LINES) {
setup_git_directory_gently(&nongit);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
}
if (strbuf_read(&buf, 0, 1024) < 0)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index d8a6fa47e59..89ee09abea6 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -649,7 +649,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
"--ignore-submodules=dirty", "--quiet", "--",
path, NULL);
- git_config(git_diff_basic_config, NULL);
+ repo_config(the_repository, git_diff_basic_config, NULL);
repo_init_revisions(the_repository, &rev, NULL);
rev.abbrev = 0;
@@ -1108,7 +1108,7 @@ static int compute_summary_module_list(struct object_id *head_oid,
if (info->argc)
strvec_pushv(&diff_args, info->argv);
- git_config(git_diff_basic_config, NULL);
+ repo_config(the_repository, git_diff_basic_config, NULL);
repo_init_revisions(the_repository, &rev, info->prefix);
rev.abbrev = 0;
precompose_argv_prefix(diff_args.nr, diff_args.v, NULL);
@@ -2830,7 +2830,7 @@ static int module_update(int argc, const char **argv, const char *prefix,
};
update_clone_config_from_gitmodules(&opt.max_jobs);
- git_config(git_update_clone_config, &opt.max_jobs);
+ repo_config(the_repository, git_update_clone_config, &opt.max_jobs);
argc = parse_options(argc, argv, prefix, module_update_options,
git_submodule_helper_usage, 0);
@@ -3128,7 +3128,7 @@ static int module_create_branch(int argc, const char **argv, const char *prefix,
NULL
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
track = git_branch_track;
argc = parse_options(argc, argv, prefix, options, usage, 0);
diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c
index 299d23d76a8..5c4623067c5 100644
--- a/builtin/symbolic-ref.c
+++ b/builtin/symbolic-ref.c
@@ -59,7 +59,7 @@ int cmd_symbolic_ref(int argc,
OPT_END(),
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options,
git_symbolic_ref_usage, 0);
if (msg && !*msg)
diff --git a/builtin/tag.c b/builtin/tag.c
index 46cbf892e34..25f30e3f9be 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -546,7 +546,7 @@ int cmd_tag(int argc,
* Try to set sort keys from config. If config does not set any,
* fall back on default (refname) sorting.
*/
- git_config(git_tag_config, &sorting_options);
+ repo_config(the_repository, git_tag_config, &sorting_options);
if (!sorting_options.nr)
string_list_append(&sorting_options, "refname");
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c
index 4360872ae07..ae871adc909 100644
--- a/builtin/unpack-file.c
+++ b/builtin/unpack-file.c
@@ -43,7 +43,7 @@ int cmd_unpack_file(int argc,
if (repo_get_oid(the_repository, argv[1], &oid))
die("Not a valid object name %s", argv[1]);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
puts(create_temp_file(&oid));
return 0;
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index a69d59eb50c..26aa885da92 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -621,7 +621,7 @@ int cmd_unpack_objects(int argc,
disable_replace_refs();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
quiet = !isatty(2);
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 0c1d4ed55be..2380f3ccd68 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -1103,7 +1103,7 @@ int cmd_update_index(int argc,
show_usage_with_options_if_asked(argc, argv,
update_index_usage, options);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
prepare_repo_settings(r);
the_repository->settings.command_requires_full_index = 0;
diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index 1e6131e04ad..cb936643243 100644
--- a/builtin/update-ref.c
+++ b/builtin/update-ref.c
@@ -769,7 +769,7 @@ int cmd_update_ref(int argc,
OPT_END(),
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, git_update_ref_usage,
0);
if (msg && !*msg)
diff --git a/builtin/var.c b/builtin/var.c
index ada642a9fe5..beeac12dccf 100644
--- a/builtin/var.c
+++ b/builtin/var.c
@@ -226,11 +226,11 @@ int cmd_var(int argc,
usage(var_usage);
if (strcmp(argv[1], "-l") == 0) {
- git_config(show_config, NULL);
+ repo_config(the_repository, show_config, NULL);
list_vars();
return 0;
}
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
git_var = get_git_var(argv[1]);
if (!git_var)
diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c
index 34e4ed715f3..d9f66f5e767 100644
--- a/builtin/verify-pack.c
+++ b/builtin/verify-pack.c
@@ -81,7 +81,7 @@ int cmd_verify_pack(int argc,
OPT_END()
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, verify_pack_options,
verify_pack_usage, 0);
if (argc < 1)
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 2dceeeed8bd..b1306248dec 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -1448,7 +1448,7 @@ int cmd_worktree(int ac,
OPT_END()
};
- git_config(git_worktree_config, NULL);
+ repo_config(the_repository, git_worktree_config, NULL);
if (!prefix)
prefix = "";
diff --git a/builtin/write-tree.c b/builtin/write-tree.c
index cfec044710a..3465c70a48a 100644
--- a/builtin/write-tree.c
+++ b/builtin/write-tree.c
@@ -43,7 +43,7 @@ int cmd_write_tree(int argc,
OPT_END()
};
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, cmd_prefix, write_tree_options,
write_tree_usage, 0);
diff --git a/config.h b/config.h
index 29a02774837..6b729fc6bbf 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline void git_config(config_fn_t fn, void *data)
-{
- repo_config(the_repository, fn, data);
-}
-
static inline void git_config_clear(void)
{
repo_config_clear(the_repository);
diff --git a/connect.c b/connect.c
index e77287f426c..4b1dc65e5ce 100644
--- a/connect.c
+++ b/connect.c
@@ -1028,7 +1028,7 @@ static int git_proxy_command_options(const char *var, const char *value,
static int git_use_proxy(const char *host)
{
git_proxy_command = getenv("GIT_PROXY_COMMAND");
- git_config(git_proxy_command_options, (void*)host);
+ repo_config(the_repository, git_proxy_command_options, (void*)host);
return (git_proxy_command && *git_proxy_command);
}
diff --git a/contrib/coccinelle/config_fn_ctx.pending.cocci b/contrib/coccinelle/config_fn_ctx.pending.cocci
index 6d3d1000a96..54f09fcbcde 100644
--- a/contrib/coccinelle/config_fn_ctx.pending.cocci
+++ b/contrib/coccinelle/config_fn_ctx.pending.cocci
@@ -83,7 +83,7 @@ int fn(const char *C1, const char *C2,
// The previous rules don't catch all callbacks, especially if they're defined
-// in a separate file from the git_config() call. Fix these manually.
+// in a separate file from the repo_config() call. Fix these manually.
@@
identifier C1, C2, D;
attribute name UNUSED;
diff --git a/convert.c b/convert.c
index b5f7cf6306c..c7d6a85c226 100644
--- a/convert.c
+++ b/convert.c
@@ -1326,7 +1326,7 @@ void convert_attrs(struct index_state *istate,
"eol", "text", "working-tree-encoding",
NULL);
user_convert_tail = &user_convert;
- git_config(read_convert_config, NULL);
+ repo_config(the_repository, read_convert_config, NULL);
}
git_check_attr(istate, path, check);
diff --git a/fetch-pack.c b/fetch-pack.c
index 01d3699c4b7..11344206f73 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1916,7 +1916,7 @@ static void fetch_pack_config(void)
}
}
- git_config(fetch_pack_config_cb, NULL);
+ repo_config(the_repository, fetch_pack_config_cb, NULL);
}
static void fetch_pack_setup(void)
diff --git a/fsck.h b/fsck.h
index 0c5869ac34e..dd7df3d5b36 100644
--- a/fsck.h
+++ b/fsck.h
@@ -287,7 +287,7 @@ const char *fsck_describe_object(struct fsck_options *options,
struct key_value_info;
/*
- * git_config() callback for use by fsck-y tools that want to support
+ * repo_config() callback for use by fsck-y tools that want to support
* fsck.<msg> fsck.skipList etc.
*/
int git_fsck_config(const char *var, const char *value,
diff --git a/gpg-interface.c b/gpg-interface.c
index bdcc8c2a2ed..bc0c21ebab1 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -25,7 +25,7 @@ static void gpg_interface_lazy_init(void)
if (done)
return;
done = 1;
- git_config(git_gpg_config, NULL);
+ repo_config(the_repository, git_gpg_config, NULL);
}
static char *configured_signing_key;
diff --git a/help.c b/help.c
index 652efebf00c..db62cda4442 100644
--- a/help.c
+++ b/help.c
@@ -332,7 +332,7 @@ static int get_colopts(const char *var, const char *value,
void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds)
{
unsigned int colopts = 0;
- git_config(get_colopts, &colopts);
+ repo_config(the_repository, get_colopts, &colopts);
if (main_cmds->cnt) {
const char *exec_path = git_exec_path();
@@ -502,7 +502,7 @@ static void list_all_cmds_help_aliases(int longest)
struct cmdname_help *aliases;
int i;
- git_config(get_alias, &alias_list);
+ repo_config(the_repository, get_alias, &alias_list);
string_list_sort(&alias_list);
for (i = 0; i < alias_list.nr; i++) {
diff --git a/http-fetch.c b/http-fetch.c
index 02ab80533f0..17b9fe4ff8c 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -150,7 +150,7 @@ int cmd_main(int argc, const char **argv)
trace2_cmd_name("http-fetch");
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
if (packfile) {
if (!index_pack_args.nr)
diff --git a/http.c b/http.c
index 9b62f627dc5..d94e8f63b57 100644
--- a/http.c
+++ b/http.c
@@ -1315,7 +1315,7 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
http_is_verbose = 0;
normalized_url = url_normalize(url, &config.url);
- git_config(urlmatch_config_entry, &config);
+ repo_config(the_repository, urlmatch_config_entry, &config);
free(normalized_url);
string_list_clear(&config.vars, 1);
diff --git a/imap-send.c b/imap-send.c
index f5a656ac71d..9b26c669c01 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1776,7 +1776,7 @@ int cmd_main(int argc, const char **argv)
int ret;
setup_git_directory_gently(&nongit_ok);
- git_config(git_imap_config, &server);
+ repo_config(the_repository, git_imap_config, &server);
argc = parse_options(argc, (const char **)argv, "", imap_send_options, imap_send_usage, 0);
diff --git a/ls-refs.c b/ls-refs.c
index e28c8413758..c47acde07f3 100644
--- a/ls-refs.c
+++ b/ls-refs.c
@@ -159,7 +159,7 @@ int ls_refs(struct repository *r, struct packet_reader *request)
strbuf_init(&data.buf, 0);
strvec_init(&data.hidden_refs);
- git_config(ls_refs_config, &data);
+ repo_config(the_repository, ls_refs_config, &data);
while (packet_reader_read(request) == PACKET_READ_NORMAL) {
const char *arg = request->line;
diff --git a/merge-ll.c b/merge-ll.c
index b2dc26da4fe..fafe2c91971 100644
--- a/merge-ll.c
+++ b/merge-ll.c
@@ -357,7 +357,7 @@ static void initialize_ll_merge(void)
if (ll_user_merge_tail)
return;
ll_user_merge_tail = &ll_user_merge;
- git_config(read_merge_config, NULL);
+ repo_config(the_repository, read_merge_config, NULL);
}
static const struct ll_merge_driver *find_ll_merge_driver(const char *merge_attr)
diff --git a/merge-ort.c b/merge-ort.c
index 473ff61e36e..49aa37a8f23 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -5387,7 +5387,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)
free(value);
}
}
- git_config(git_xmerge_config, NULL);
+ repo_config(the_repository, git_xmerge_config, NULL);
}
static void init_merge_options(struct merge_options *opt,
diff --git a/notes-utils.c b/notes-utils.c
index ac66b82dd31..6a50c6d5646 100644
--- a/notes-utils.c
+++ b/notes-utils.c
@@ -162,7 +162,7 @@ struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd)
c->refs_from_env = 1;
string_list_add_refs_from_colon_sep(c->refs, rewrite_refs_env);
}
- git_config(notes_rewrite_config, c);
+ repo_config(the_repository, notes_rewrite_config, c);
if (!c->enabled || !c->refs->nr) {
string_list_clear(c->refs, 0);
free(c->refs);
diff --git a/notes.c b/notes.c
index 97b995f3f2d..49393fbfd8d 100644
--- a/notes.c
+++ b/notes.c
@@ -1123,7 +1123,7 @@ void load_display_notes(struct display_notes_opt *opt)
load_config_refs = 1;
}
- git_config(notes_display_config, &load_config_refs);
+ repo_config(the_repository, notes_display_config, &load_config_refs);
if (opt) {
struct string_list_item *item;
diff --git a/pretty.c b/pretty.c
index 0bc8ad8a9a8..cee96b9d94d 100644
--- a/pretty.c
+++ b/pretty.c
@@ -141,7 +141,7 @@ static void setup_commit_formats(void)
COPY_ARRAY(commit_formats, builtin_formats,
ARRAY_SIZE(builtin_formats));
- git_config(git_pretty_formats_config, NULL);
+ repo_config(the_repository, git_pretty_formats_config, NULL);
}
static struct cmt_fmt_map *find_commit_format_recursive(const char *sought,
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
index 4c3817f4ec1..5134781d52d 100644
--- a/refs/reftable-backend.c
+++ b/refs/reftable-backend.c
@@ -386,7 +386,7 @@ static struct ref_store *reftable_be_init(struct repository *repo,
refs->write_options.lock_timeout_ms = 100;
refs->write_options.fsync = reftable_be_fsync;
- git_config(reftable_be_config, &refs->write_options);
+ repo_config(the_repository, reftable_be_config, &refs->write_options);
/*
* It is somewhat unfortunate that we have to mirror the default block
diff --git a/rerere.c b/rerere.c
index 8bb97c98229..1ac2075144c 100644
--- a/rerere.c
+++ b/rerere.c
@@ -879,7 +879,7 @@ static void git_rerere_config(void)
{
git_config_get_bool("rerere.enabled", &rerere_enabled);
git_config_get_bool("rerere.autoupdate", &rerere_autoupdate);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
}
static GIT_PATH_FUNC(git_path_rr_cache, "rr-cache")
@@ -1247,7 +1247,7 @@ void rerere_gc(struct repository *r, struct string_list *rr)
&cutoff_resolve, now);
repo_config_get_expiry_in_days(the_repository, "gc.rerereunresolved",
&cutoff_noresolve, now);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
dir = opendir(repo_git_path_replace(the_repository, &buf, "rr-cache"));
if (!dir)
die_errno(_("unable to open rr-cache directory"));
diff --git a/revision.c b/revision.c
index 0ca6a297a6b..ad63c100eb9 100644
--- a/revision.c
+++ b/revision.c
@@ -1636,7 +1636,7 @@ void exclude_hidden_refs(struct ref_exclusions *exclusions, const char *section)
cb.exclusions = exclusions;
cb.section = section;
- git_config(hide_refs_config, &cb);
+ repo_config(the_repository, hide_refs_config, &cb);
}
struct all_refs_cb {
diff --git a/scalar.c b/scalar.c
index 0dc79fa9fb0..3b713abca3c 100644
--- a/scalar.c
+++ b/scalar.c
@@ -713,7 +713,7 @@ static int cmd_reconfigure(int argc, const char **argv)
maintenance_str);
}
- git_config(get_scalar_repos, &scalar_repos);
+ repo_config(the_repository, get_scalar_repos, &scalar_repos);
for (size_t i = 0; i < scalar_repos.nr; i++) {
int succeeded = 0;
diff --git a/sequencer.c b/sequencer.c
index 67e4310edcf..df207f33e07 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -327,7 +327,7 @@ static int git_sequencer_config(const char *k, const char *v,
void sequencer_init_config(struct replay_opts *opts)
{
opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE;
- git_config(git_sequencer_config, opts);
+ repo_config(the_repository, git_sequencer_config, opts);
}
static inline int is_rebase_i(const struct replay_opts *opts)
diff --git a/setup.c b/setup.c
index 6f52dab64ca..91a3affdd8f 100644
--- a/setup.c
+++ b/setup.c
@@ -2339,7 +2339,7 @@ static int create_default_files(const char *template_path,
copy_templates(template_path);
git_config_clear();
repo_settings_reset_shared_repository(the_repository);
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
reinit = is_reinit();
@@ -2610,7 +2610,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
* have set up the repository format such that we can evaluate
* includeIf conditions correctly in the case of re-initialization.
*/
- git_config(platform_core_config, NULL);
+ repo_config(the_repository, platform_core_config, NULL);
safe_create_dir(the_repository, git_dir, 0);
diff --git a/t/helper/test-advise.c b/t/helper/test-advise.c
index 6967c8e25c6..77c15a46cfa 100644
--- a/t/helper/test-advise.c
+++ b/t/helper/test-advise.c
@@ -11,7 +11,7 @@ int cmd__advise_if_enabled(int argc, const char **argv)
die("usage: %s <advice>", argv[0]);
setup_git_directory();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
/*
* Any advice type can be used for testing, but NESTED_TAG was
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 75e028ab2a0..41ba8647900 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -32,10 +32,10 @@
* ascending order of priority from a config_set
* constructed from files entered as arguments.
*
- * iterate -> iterate over all values using git_config(), and print some
+ * iterate -> iterate over all values using repo_config(), and print some
* data for each
*
- * git_config_int -> iterate over all values using git_config() and print the
+ * git_config_int -> iterate over all values using repo_config() and print the
* integer value for the entered key or die
*
* Examples:
@@ -218,10 +218,10 @@ int cmd__config(int argc, const char **argv)
goto exit1;
}
} else if (!strcmp(argv[1], "iterate")) {
- git_config(iterate_cb, NULL);
+ repo_config(the_repository, iterate_cb, NULL);
goto exit0;
} else if (argc == 3 && !strcmp(argv[1], "git_config_int")) {
- git_config(parse_int_cb, (void *) argv[2]);
+ repo_config(the_repository, parse_int_cb, (void *) argv[2]);
goto exit0;
}
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index e277dde8e71..b2da48eda05 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -19,7 +19,7 @@ int cmd__read_cache(int argc, const char **argv)
if (argc == 2)
cnt = strtol(argv[1], NULL, 0);
setup_git_directory();
- git_config(git_default_config, NULL);
+ repo_config(the_repository, git_default_config, NULL);
for (i = 0; i < cnt; i++) {
repo_read_index(the_repository);
diff --git a/t/helper/test-userdiff.c b/t/helper/test-userdiff.c
index 94c48ababbe..aa3a9894d25 100644
--- a/t/helper/test-userdiff.c
+++ b/t/helper/test-userdiff.c
@@ -41,7 +41,7 @@ int cmd__userdiff(int argc, const char **argv)
if (want & USERDIFF_DRIVER_TYPE_CUSTOM) {
setup_git_directory();
- git_config(cmd__userdiff_config, NULL);
+ repo_config(the_repository, cmd__userdiff_config, NULL);
}
for_each_userdiff_driver(driver_cb, &want);
diff --git a/t/t4256/1/mailinfo.c b/t/t4256/1/mailinfo.c
index b395adbdf2a..39caeba8653 100644
--- a/t/t4256/1/mailinfo.c
+++ b/t/t4256/1/mailinfo.c
@@ -1214,7 +1214,7 @@ void setup_mailinfo(struct mailinfo *mi)
mi->header_stage = 1;
mi->use_inbody_headers = 1;
mi->content_top = mi->content;
- git_config(git_mailinfo_config, mi);
+ repo_config(the_repository, git_mailinfo_config, mi);
}
void clear_mailinfo(struct mailinfo *mi)
diff --git a/t/t4256/1/mailinfo.c.orig b/t/t4256/1/mailinfo.c.orig
index 3281a37d518..b76eb866aae 100644
--- a/t/t4256/1/mailinfo.c.orig
+++ b/t/t4256/1/mailinfo.c.orig
@@ -1154,7 +1154,7 @@ void setup_mailinfo(struct mailinfo *mi)
mi->header_stage = 1;
mi->use_inbody_headers = 1;
mi->content_top = mi->content;
- git_config(git_mailinfo_config, mi);
+ repo_config(the_repository, git_mailinfo_config, mi);
}
void clear_mailinfo(struct mailinfo *mi)
diff --git a/trailer.c b/trailer.c
index 310cf582dc3..911a81ed993 100644
--- a/trailer.c
+++ b/trailer.c
@@ -595,8 +595,8 @@ void trailer_config_init(void)
default_conf_info.where = WHERE_END;
default_conf_info.if_exists = EXISTS_ADD_IF_DIFFERENT_NEIGHBOR;
default_conf_info.if_missing = MISSING_ADD;
- git_config(git_trailer_default_config, NULL);
- git_config(git_trailer_config, NULL);
+ repo_config(the_repository, git_trailer_default_config, NULL);
+ repo_config(the_repository, git_trailer_config, NULL);
configured = 1;
}
diff --git a/transport.c b/transport.c
index c123ac1e38b..a246afd09fa 100644
--- a/transport.c
+++ b/transport.c
@@ -202,7 +202,7 @@ static int fetch_refs_from_bundle(struct transport *transport,
if (!data->get_refs_from_bundle_called)
get_refs_from_bundle_inner(transport);
- git_config(fetch_fsck_config_cb, &msg_types);
+ repo_config(the_repository, fetch_fsck_config_cb, &msg_types);
opts.fsck_msg_types = msg_types.buf;
ret = unbundle(the_repository, &data->header, data->fd,
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 02/21] config: drop `git_config_clear()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 01/21] config: drop `git_config()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 03/21] config: drop `git_config_get()` wrapper Patrick Steinhardt
` (18 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_clear()`. All
callsites are adjusted so that they use
`repo_config_clear(the_repository, ...)` instead. While some callsites
might already have a repository available, this mechanical conversion is
the exact same as the current situation and thus cannot cause any
regression. Those sites should eventually be cleaned up in a later patch
series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
config.h | 5 -----
scalar.c | 2 +-
setup.c | 4 ++--
3 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/config.h b/config.h
index 6b729fc6bbf..4eea99e9b95 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline void git_config_clear(void)
-{
- repo_config_clear(the_repository);
-}
-
static inline int git_config_get(const char *key)
{
return repo_config_get(the_repository, key);
diff --git a/scalar.c b/scalar.c
index 3b713abca3c..2aaff5aa109 100644
--- a/scalar.c
+++ b/scalar.c
@@ -763,7 +763,7 @@ static int cmd_reconfigure(int argc, const char **argv)
break;
}
- git_config_clear();
+ repo_config_clear(the_repository);
if (repo_init(&r, gitdir.buf, commondir.buf))
goto loop_end;
diff --git a/setup.c b/setup.c
index 91a3affdd8f..9661c5d5d5d 100644
--- a/setup.c
+++ b/setup.c
@@ -1741,7 +1741,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
* configuration (including the per-repo config file that we
* ignored previously).
*/
- git_config_clear();
+ repo_config_clear(the_repository);
/*
* Let's assume that we are in a git repository.
@@ -2337,7 +2337,7 @@ static int create_default_files(const char *template_path,
* disk).
*/
copy_templates(template_path);
- git_config_clear();
+ repo_config_clear(the_repository);
repo_settings_reset_shared_repository(the_repository);
repo_config(the_repository, git_default_config, NULL);
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 03/21] config: drop `git_config_get()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 01/21] config: drop `git_config()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 02/21] config: drop `git_config_clear()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 04/21] config: drop `git_config_get_value()` wrapper Patrick Steinhardt
` (17 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get()`. All
callsites are adjusted so that they use `repo_config_get(the_repository,
...)` instead. While some callsites might already have a repository
available, this mechanical conversion is the exact same as the current
situation and thus cannot cause any regression. Those sites should
eventually be cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/gc.c | 2 +-
builtin/submodule--helper.c | 6 +++---
config.h | 5 -----
t/helper/test-config.c | 2 +-
4 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index d9e3b9d2ec3..e5c3d082eda 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1916,7 +1916,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
git_config_set("maintenance.auto", "false");
/* Set maintenance strategy, if unset */
- if (git_config_get("maintenance.strategy"))
+ if (repo_config_get(the_repository, "maintenance.strategy"))
git_config_set("maintenance.strategy", "incremental");
if (!git_config_get_string_multi(key, &list)) {
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 89ee09abea6..6bcc741a6ac 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -549,7 +549,7 @@ static int module_init(int argc, const char **argv, const char *prefix,
* If there are no path args and submodule.active is set then,
* by default, only initialize 'active' modules.
*/
- if (!argc && !git_config_get("submodule.active"))
+ if (!argc && !repo_config_get(the_repository, "submodule.active"))
module_list_active(&list);
info.prefix = prefix;
@@ -2878,7 +2878,7 @@ static int module_update(int argc, const char **argv, const char *prefix,
* If there are no path args and submodule.active is set then,
* by default, only initialize 'active' modules.
*/
- if (!argc && !git_config_get("submodule.active"))
+ if (!argc && !repo_config_get(the_repository, "submodule.active"))
module_list_active(&list);
info.prefix = opt.prefix;
@@ -3349,7 +3349,7 @@ static void configure_added_submodule(struct add_data *add_data)
* is_submodule_active(), since that function needs to find
* out the value of "submodule.active" again anyway.
*/
- if (!git_config_get("submodule.active")) {
+ if (!repo_config_get(the_repository, "submodule.active")) {
/*
* If the submodule being added isn't already covered by the
* current configured pathspec, set the submodule's active flag
diff --git a/config.h b/config.h
index 4eea99e9b95..9261ed0f8d7 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get(const char *key)
-{
- return repo_config_get(the_repository, key);
-}
-
static inline int git_config_get_value(const char *key, const char **value)
{
return repo_config_get_value(the_repository, key, value);
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 41ba8647900..cacf6f306b1 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -137,7 +137,7 @@ int cmd__config(int argc, const char **argv)
} else if (argc == 3 && !strcmp(argv[1], "get")) {
int ret;
- if (!(ret = git_config_get(argv[2])))
+ if (!(ret = repo_config_get(the_repository, argv[2])))
goto exit0;
else if (ret == 1)
printf("Value not found for \"%s\"\n", argv[2]);
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 04/21] config: drop `git_config_get_value()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (2 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 03/21] config: drop `git_config_get()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 05/21] " Patrick Steinhardt
` (16 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_value()`. All
callsites are adjusted so that they use
`repo_config_get_value(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/gc.c | 4 ++--
builtin/pull.c | 6 +++---
config.h | 5 -----
rebase-interactive.c | 2 +-
t/helper/test-config.c | 2 +-
5 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index e5c3d082eda..e94931ff48f 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -114,7 +114,7 @@ static int gc_config_is_timestamp_never(const char *var)
const char *value;
timestamp_t expire;
- if (!git_config_get_value(var, &value) && value) {
+ if (!repo_config_get_value(the_repository, var, &value) && value) {
if (parse_expiry_date(value, &expire))
die(_("failed to parse '%s' value '%s'"), var, value);
return expire == 0;
@@ -178,7 +178,7 @@ static void gc_config(struct gc_config *cfg)
char *owned = NULL;
unsigned long ulongval;
- if (!git_config_get_value("gc.packrefs", &value)) {
+ if (!repo_config_get_value(the_repository, "gc.packrefs", &value)) {
if (value && !strcmp(value, "notbare"))
cfg->pack_refs = -1;
else
diff --git a/builtin/pull.c b/builtin/pull.c
index d13ed9b5176..5ea51c31f58 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -312,7 +312,7 @@ static const char *config_get_ff(void)
{
const char *value;
- if (git_config_get_value("pull.ff", &value))
+ if (repo_config_get_value(the_repository, "pull.ff", &value))
return NULL;
switch (git_parse_maybe_bool(value)) {
@@ -343,7 +343,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)
if (curr_branch) {
char *key = xstrfmt("branch.%s.rebase", curr_branch->name);
- if (!git_config_get_value(key, &value)) {
+ if (!repo_config_get_value(the_repository, key, &value)) {
enum rebase_type ret = parse_config_rebase(key, value, 1);
free(key);
return ret;
@@ -352,7 +352,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)
free(key);
}
- if (!git_config_get_value("pull.rebase", &value))
+ if (!repo_config_get_value(the_repository, "pull.rebase", &value))
return parse_config_rebase("pull.rebase", value, 1);
*rebase_unspecified = 1;
diff --git a/config.h b/config.h
index 9261ed0f8d7..5dc330b88b1 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_value(const char *key, const char **value)
-{
- return repo_config_get_value(the_repository, key, value);
-}
-
static inline int git_config_get_value_multi(const char *key, const struct string_list **dest)
{
return repo_config_get_value_multi(the_repository, key, dest);
diff --git a/rebase-interactive.c b/rebase-interactive.c
index cbeb8641477..809f76a87b8 100644
--- a/rebase-interactive.c
+++ b/rebase-interactive.c
@@ -30,7 +30,7 @@ static enum missing_commit_check_level get_missing_commit_check_level(void)
{
const char *value;
- if (git_config_get_value("rebase.missingcommitscheck", &value) ||
+ if (repo_config_get_value(the_repository, "rebase.missingcommitscheck", &value) ||
!strcasecmp("ignore", value))
return MISSING_COMMIT_CHECK_IGNORE;
if (!strcasecmp("warn", value))
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index cacf6f306b1..99c91512173 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -110,7 +110,7 @@ int cmd__config(int argc, const char **argv)
fprintf(stderr, "Please, provide a command name on the command-line\n");
goto exit1;
} else if (argc == 3 && !strcmp(argv[1], "get_value")) {
- if (!git_config_get_value(argv[2], &v)) {
+ if (!repo_config_get_value(the_repository, argv[2], &v)) {
if (!v)
printf("(NULL)\n");
else
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 05/21] config: drop `git_config_get_value()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (3 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 04/21] config: drop `git_config_get_value()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 06/21] config: drop `git_config_get_string_multi()` wrapper Patrick Steinhardt
` (15 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_value()`. All
callsites are adjusted so that they use
`repo_config_get_value(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
config.h | 5 -----
t/helper/test-config.c | 2 +-
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/config.h b/config.h
index 5dc330b88b1..e90c1c4d335 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_value_multi(const char *key, const struct string_list **dest)
-{
- return repo_config_get_value_multi(the_repository, key, dest);
-}
-
static inline int git_config_get_string_multi(const char *key,
const struct string_list **dest)
{
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 99c91512173..1953ab846e4 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -121,7 +121,7 @@ int cmd__config(int argc, const char **argv)
goto exit1;
}
} else if (argc == 3 && !strcmp(argv[1], "get_value_multi")) {
- if (!git_config_get_value_multi(argv[2], &strptr)) {
+ if (!repo_config_get_value_multi(the_repository, argv[2], &strptr)) {
for (i = 0; i < strptr->nr; i++) {
v = strptr->items[i].string;
if (!v)
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 06/21] config: drop `git_config_get_string_multi()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (4 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 05/21] " Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 07/21] config: drop `git_config_get_string()` wrapper Patrick Steinhardt
` (14 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove
`git_config_get_string_multi()`. All callsites are adjusted so that they
use `repo_config_get_string_multi(the_repository, ...)` instead. While
some callsites might already have a repository available, this
mechanical conversion is the exact same as the current situation and
thus cannot cause any regression. Those sites should eventually be
cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/gc.c | 4 ++--
builtin/log.c | 2 +-
config.h | 6 ------
reachable.c | 2 +-
versioncmp.c | 4 ++--
5 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index e94931ff48f..f395cc57a15 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1919,7 +1919,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
if (repo_config_get(the_repository, "maintenance.strategy"))
git_config_set("maintenance.strategy", "incremental");
- if (!git_config_get_string_multi(key, &list)) {
+ if (!repo_config_get_string_multi(the_repository, key, &list)) {
for_each_string_list_item(item, list) {
if (!strcmp(maintpath, item->string)) {
found = 1;
@@ -1988,7 +1988,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
}
if (!(config_file
? git_configset_get_string_multi(&cs, key, &list)
- : git_config_get_string_multi(key, &list))) {
+ : repo_config_get_string_multi(the_repository, key, &list))) {
for_each_string_list_item(item, list) {
if (!strcmp(maintpath, item->string)) {
found = 1;
diff --git a/builtin/log.c b/builtin/log.c
index 1bedc4ef355..b512f12e805 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -221,7 +221,7 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
struct string_list *include = decoration_filter->include_ref_pattern;
const struct string_list *config_exclude;
- if (!git_config_get_string_multi("log.excludeDecoration",
+ if (!repo_config_get_string_multi(the_repository, "log.excludeDecoration",
&config_exclude)) {
struct string_list_item *item;
for_each_string_list_item(item, config_exclude)
diff --git a/config.h b/config.h
index e90c1c4d335..f6635e48c23 100644
--- a/config.h
+++ b/config.h
@@ -719,12 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_string_multi(const char *key,
- const struct string_list **dest)
-{
- return repo_config_get_string_multi(the_repository, key, dest);
-}
-
static inline int git_config_get_string(const char *key, char **dest)
{
return repo_config_get_string(the_repository, key, dest);
diff --git a/reachable.c b/reachable.c
index e984b68a0c4..8330a14fa82 100644
--- a/reachable.c
+++ b/reachable.c
@@ -170,7 +170,7 @@ static void load_gc_recent_objects(struct recent_data *data)
data->extra_recent_oids_loaded = 1;
- if (git_config_get_string_multi("gc.recentobjectshook", &programs))
+ if (repo_config_get_string_multi(the_repository, "gc.recentobjectshook", &programs))
return;
for (i = 0; i < programs->nr; i++) {
diff --git a/versioncmp.c b/versioncmp.c
index b6eebdb989c..3a81b17bc1b 100644
--- a/versioncmp.c
+++ b/versioncmp.c
@@ -167,8 +167,8 @@ int versioncmp(const char *s1, const char *s2)
const char *const oldk = "versionsort.prereleasesuffix";
const struct string_list *newl;
const struct string_list *oldl;
- int new = git_config_get_string_multi(newk, &newl);
- int old = git_config_get_string_multi(oldk, &oldl);
+ int new = repo_config_get_string_multi(the_repository, newk, &newl);
+ int old = repo_config_get_string_multi(the_repository, oldk, &oldl);
if (!new && !old)
warning("ignoring %s because %s is set", oldk, newk);
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 07/21] config: drop `git_config_get_string()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (5 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 06/21] config: drop `git_config_get_string_multi()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 08/21] " Patrick Steinhardt
` (13 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_string()`.
All callsites are adjusted so that they use
`repo_config_get_string(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
apply.c | 4 ++--
branch.c | 2 +-
builtin/gc.c | 4 ++--
builtin/log.c | 2 +-
builtin/notes.c | 2 +-
builtin/submodule--helper.c | 12 ++++++------
config.h | 5 -----
fetch-pack.c | 2 +-
merge-ort.c | 8 ++++----
scalar.c | 4 ++--
sequencer.c | 2 +-
transport.c | 8 ++++----
12 files changed, 25 insertions(+), 30 deletions(-)
diff --git a/apply.c b/apply.c
index d2381a157c0..45eb790d133 100644
--- a/apply.c
+++ b/apply.c
@@ -48,8 +48,8 @@ struct gitdiff_data {
static void git_apply_config(void)
{
- git_config_get_string("apply.whitespace", &apply_default_whitespace);
- git_config_get_string("apply.ignorewhitespace", &apply_default_ignorewhitespace);
+ repo_config_get_string(the_repository, "apply.whitespace", &apply_default_whitespace);
+ repo_config_get_string(the_repository, "apply.ignorewhitespace", &apply_default_ignorewhitespace);
repo_config(the_repository, git_xmerge_config, NULL);
}
diff --git a/branch.c b/branch.c
index 93f5b4e8dd9..b4811671fc7 100644
--- a/branch.c
+++ b/branch.c
@@ -355,7 +355,7 @@ int read_branch_desc(struct strbuf *buf, const char *branch_name)
char *v = NULL;
struct strbuf name = STRBUF_INIT;
strbuf_addf(&name, "branch.%s.description", branch_name);
- if (git_config_get_string(name.buf, &v)) {
+ if (repo_config_get_string(the_repository, name.buf, &v)) {
strbuf_release(&name);
return -1;
}
diff --git a/builtin/gc.c b/builtin/gc.c
index f395cc57a15..d8f7a1858cb 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -218,12 +218,12 @@ static void gc_config(struct gc_config *cfg)
if (!git_config_get_ulong("core.deltabasecachelimit", &ulongval))
cfg->delta_base_cache_limit = ulongval;
- if (!git_config_get_string("gc.repackfilter", &owned)) {
+ if (!repo_config_get_string(the_repository, "gc.repackfilter", &owned)) {
free(cfg->repack_filter);
cfg->repack_filter = owned;
}
- if (!git_config_get_string("gc.repackfilterto", &owned)) {
+ if (!repo_config_get_string(the_repository, "gc.repackfilterto", &owned)) {
free(cfg->repack_filter_to);
cfg->repack_filter_to = owned;
}
diff --git a/builtin/log.c b/builtin/log.c
index b512f12e805..a9969ad00a0 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -235,7 +235,7 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
* since the command-line takes precedent.
*/
if (use_default_decoration_filter &&
- !git_config_get_string("log.initialdecorationset", &value) &&
+ !repo_config_get_string(the_repository, "log.initialdecorationset", &value) &&
!strcmp("all", value))
use_default_decoration_filter = 0;
free(value);
diff --git a/builtin/notes.c b/builtin/notes.c
index 17004cdb10e..d2252cf5346 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -873,7 +873,7 @@ static int git_config_get_notes_strategy(const char *key,
{
char *value;
- if (git_config_get_string(key, &value))
+ if (repo_config_get_string(the_repository, key, &value))
return 1;
if (parse_notes_merge_strategy(value, strategy))
git_die_config(the_repository, key, _("unknown notes merge strategy %s"), value);
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 6bcc741a6ac..18aa69f0cae 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -53,7 +53,7 @@ static char *resolve_relative_url(const char *rel_url, const char *up_path, int
struct strbuf remotesb = STRBUF_INIT;
strbuf_addf(&remotesb, "remote.%s.url", remote);
- if (git_config_get_string(remotesb.buf, &remoteurl)) {
+ if (repo_config_get_string(the_repository, remotesb.buf, &remoteurl)) {
if (!quiet)
warning(_("could not look up configuration '%s'. "
"Assuming this repository is its own "
@@ -468,7 +468,7 @@ static void init_submodule(const char *path, const char *prefix,
* .gitmodules, so look it up directly.
*/
strbuf_addf(&sb, "submodule.%s.url", sub->name);
- if (git_config_get_string(sb.buf, &url)) {
+ if (repo_config_get_string(the_repository, sb.buf, &url)) {
if (!sub->url)
die(_("No url found for submodule path '%s' in .gitmodules"),
displaypath);
@@ -1623,11 +1623,11 @@ static void prepare_possible_alternates(const char *sm_name,
char *sm_alternate = NULL, *error_strategy = NULL;
struct submodule_alternate_setup sas = SUBMODULE_ALTERNATE_SETUP_INIT;
- git_config_get_string("submodule.alternateLocation", &sm_alternate);
+ repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate);
if (!sm_alternate)
return;
- git_config_get_string("submodule.alternateErrorStrategy", &error_strategy);
+ repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy);
if (!error_strategy)
error_strategy = xstrdup("die");
@@ -1808,11 +1808,11 @@ static int clone_submodule(const struct module_clone_data *clone_data,
die(_("could not get submodule directory for '%s'"), clone_data_path);
/* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */
- git_config_get_string("submodule.alternateLocation", &sm_alternate);
+ repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate);
if (sm_alternate)
git_config_set_in_file(p, "submodule.alternateLocation",
sm_alternate);
- git_config_get_string("submodule.alternateErrorStrategy", &error_strategy);
+ repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy);
if (error_strategy)
git_config_set_in_file(p, "submodule.alternateErrorStrategy",
error_strategy);
diff --git a/config.h b/config.h
index f6635e48c23..8887ebf62ea 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_string(const char *key, char **dest)
-{
- return repo_config_get_string(the_repository, key, dest);
-}
-
static inline int git_config_get_string_tmp(const char *key, const char **dest)
{
return repo_config_get_string_tmp(the_repository, key, dest);
diff --git a/fetch-pack.c b/fetch-pack.c
index 11344206f73..04768087879 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1910,7 +1910,7 @@ static void fetch_pack_config(void)
if (!uri_protocols.nr) {
char *str;
- if (!git_config_get_string("fetch.uriprotocols", &str) && str) {
+ if (!repo_config_get_string(the_repository, "fetch.uriprotocols", &str) && str) {
string_list_split(&uri_protocols, str, ',', -1);
free(str);
}
diff --git a/merge-ort.c b/merge-ort.c
index 49aa37a8f23..29789579c9b 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -5358,15 +5358,15 @@ static void merge_recursive_config(struct merge_options *opt, int ui)
git_config_get_int("merge.renamelimit", &opt->rename_limit);
git_config_get_bool("merge.renormalize", &renormalize);
opt->renormalize = renormalize;
- if (!git_config_get_string("diff.renames", &value)) {
+ if (!repo_config_get_string(the_repository, "diff.renames", &value)) {
opt->detect_renames = git_config_rename("diff.renames", value);
free(value);
}
- if (!git_config_get_string("merge.renames", &value)) {
+ if (!repo_config_get_string(the_repository, "merge.renames", &value)) {
opt->detect_renames = git_config_rename("merge.renames", value);
free(value);
}
- if (!git_config_get_string("merge.directoryrenames", &value)) {
+ if (!repo_config_get_string(the_repository, "merge.directoryrenames", &value)) {
int boolval = git_parse_maybe_bool(value);
if (0 <= boolval) {
opt->detect_directory_renames = boolval ?
@@ -5379,7 +5379,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)
free(value);
}
if (ui) {
- if (!git_config_get_string("diff.algorithm", &value)) {
+ if (!repo_config_get_string(the_repository, "diff.algorithm", &value)) {
long diff_algorithm = parse_algorithm_value(value);
if (diff_algorithm < 0)
die(_("unknown value for config '%s': %s"), "diff.algorithm", value);
diff --git a/scalar.c b/scalar.c
index 2aaff5aa109..07f855c9913 100644
--- a/scalar.c
+++ b/scalar.c
@@ -101,7 +101,7 @@ static int set_scalar_config(const struct scalar_config *config, int reconfigure
int res;
if ((reconfigure && config->overwrite_on_reconfigure) ||
- git_config_get_string(config->key, &value)) {
+ repo_config_get_string(the_repository, config->key, &value)) {
trace2_data_string("scalar", the_repository, config->key, "created");
res = git_config_set_gently(config->key, config->value);
} else {
@@ -193,7 +193,7 @@ static int set_recommended_config(int reconfigure)
* The `log.excludeDecoration` setting is special because it allows
* for multiple values.
*/
- if (git_config_get_string("log.excludeDecoration", &value)) {
+ if (repo_config_get_string(the_repository, "log.excludeDecoration", &value)) {
trace2_data_string("scalar", the_repository,
"log.excludeDecoration", "created");
if (git_config_set_multivar_gently("log.excludeDecoration",
diff --git a/sequencer.c b/sequencer.c
index df207f33e07..f3bada39b40 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -6089,7 +6089,7 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,
revs.topo_order = 1;
revs.pretty_given = 1;
- git_config_get_string("rebase.instructionFormat", &format);
+ repo_config_get_string(the_repository, "rebase.instructionFormat", &format);
if (!format || !*format) {
free(format);
format = xstrdup("# %s");
diff --git a/transport.c b/transport.c
index a246afd09fa..89e6297ce22 100644
--- a/transport.c
+++ b/transport.c
@@ -54,14 +54,14 @@ static int transport_color_config(void)
return 0;
initialized = 1;
- if (!git_config_get_string(key, &value))
+ if (!repo_config_get_string(the_repository, key, &value))
transport_use_color = git_config_colorbool(key, value);
if (!want_color_stderr(transport_use_color))
return 0;
for (size_t i = 0; i < ARRAY_SIZE(keys); i++)
- if (!git_config_get_string(keys[i], &value)) {
+ if (!repo_config_get_string(the_repository, keys[i], &value)) {
if (!value)
return config_error_nonbool(keys[i]);
if (color_parse(value, transport_colors[i]) < 0)
@@ -1078,7 +1078,7 @@ static enum protocol_allow_config get_protocol_config(const char *type)
char *value;
/* first check the per-protocol config */
- if (!git_config_get_string(key, &value)) {
+ if (!repo_config_get_string(the_repository, key, &value)) {
enum protocol_allow_config ret =
parse_protocol_config(key, value);
free(key);
@@ -1088,7 +1088,7 @@ static enum protocol_allow_config get_protocol_config(const char *type)
free(key);
/* if defined, fallback to user-defined default for unknown protocols */
- if (!git_config_get_string("protocol.allow", &value)) {
+ if (!repo_config_get_string(the_repository, "protocol.allow", &value)) {
enum protocol_allow_config ret =
parse_protocol_config("protocol.allow", value);
free(value);
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 08/21] config: drop `git_config_get_string()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (6 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 07/21] config: drop `git_config_get_string()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 09/21] config: drop `git_config_get_int()` wrapper Patrick Steinhardt
` (12 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_string()`.
All callsites are adjusted so that they use
`repo_config_get_string(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/fetch.c | 2 +-
builtin/gc.c | 4 ++--
builtin/remote.c | 2 +-
builtin/submodule--helper.c | 4 ++--
checkout.c | 2 +-
config.h | 5 -----
connect.c | 4 ++--
editor.c | 2 +-
help.c | 2 +-
promisor-remote.c | 4 ++--
protocol.c | 2 +-
remote.c | 2 +-
sideband.c | 6 +++---
t/helper/test-config.c | 2 +-
14 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index ea447c453d1..52eae4b972d 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -2508,7 +2508,7 @@ int cmd_fetch(int argc,
if (!max_jobs)
max_jobs = online_cpus();
- if (!git_config_get_string_tmp("fetch.bundleuri", &bundle_uri) &&
+ if (!repo_config_get_string_tmp(the_repository, "fetch.bundleuri", &bundle_uri) &&
fetch_bundle_uri(the_repository, bundle_uri, NULL))
warning(_("failed to fetch bundles from '%s'"), bundle_uri);
diff --git a/builtin/gc.c b/builtin/gc.c
index d8f7a1858cb..a2b8fbc9f3d 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1765,7 +1765,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,
if (opts->schedule) {
strategy = none_strategy;
- if (!git_config_get_string_tmp("maintenance.strategy", &config_str)) {
+ if (!repo_config_get_string_tmp(the_repository, "maintenance.strategy", &config_str)) {
if (!strcasecmp(config_str, "incremental"))
strategy = incremental_strategy;
}
@@ -1788,7 +1788,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,
strbuf_reset(&config_name);
strbuf_addf(&config_name, "maintenance.%s.schedule",
tasks[i].name);
- if (!git_config_get_string_tmp(config_name.buf, &config_str))
+ if (!repo_config_get_string_tmp(the_repository, config_name.buf, &config_str))
strategy.tasks[i].schedule = parse_schedule(config_str);
if (strategy.tasks[i].schedule < opts->schedule)
continue;
diff --git a/builtin/remote.c b/builtin/remote.c
index ebd70bea3a1..826b2dcfd04 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1268,7 +1268,7 @@ static int get_one_entry(struct remote *remote, void *priv)
strbuf_addf(&promisor_config, "remote.%s.partialclonefilter", remote->name);
strbuf_addf(&remote_info_buf, "%s (fetch)", remote->url.v[0]);
- if (!git_config_get_string_tmp(promisor_config.buf, &partial_clone_filter))
+ if (!repo_config_get_string_tmp(the_repository, promisor_config.buf, &partial_clone_filter))
strbuf_addf(&remote_info_buf, " [%s]", partial_clone_filter);
strbuf_release(&promisor_config);
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 18aa69f0cae..d2ab31835b5 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -496,7 +496,7 @@ static void init_submodule(const char *path, const char *prefix,
/* Copy "update" setting when it is not set yet */
strbuf_addf(&sb, "submodule.%s.update", sub->name);
- if (git_config_get_string_tmp(sb.buf, &upd) &&
+ if (repo_config_get_string_tmp(the_repository, sb.buf, &upd) &&
sub->update_strategy.type != SM_UPDATE_UNSPECIFIED) {
if (sub->update_strategy.type == SM_UPDATE_COMMAND) {
fprintf(stderr, _("warning: command update mode suggested for submodule '%s'\n"),
@@ -1034,7 +1034,7 @@ static void prepare_submodule_summary(struct summary_cb *info,
config_key = xstrfmt("submodule.%s.ignore",
sub->name);
- if (!git_config_get_string_tmp(config_key, &value))
+ if (!repo_config_get_string_tmp(the_repository, config_key, &value))
ignore_all = !strcmp(value, "all");
else if (sub->ignore)
ignore_all = !strcmp(sub->ignore, "all");
diff --git a/checkout.c b/checkout.c
index 0b1cf8b40b7..1588b116eed 100644
--- a/checkout.c
+++ b/checkout.c
@@ -52,7 +52,7 @@ char *unique_tracking_name(const char *name, struct object_id *oid,
{
struct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT;
const char *default_remote = NULL;
- if (!git_config_get_string_tmp("checkout.defaultremote", &default_remote))
+ if (!repo_config_get_string_tmp(the_repository, "checkout.defaultremote", &default_remote))
cb_data.default_remote = default_remote;
cb_data.src_ref = xstrfmt("refs/heads/%s", name);
cb_data.dst_oid = oid;
diff --git a/config.h b/config.h
index 8887ebf62ea..89739bee9b0 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_string_tmp(const char *key, const char **dest)
-{
- return repo_config_get_string_tmp(the_repository, key, dest);
-}
-
static inline int git_config_get_int(const char *key, int *dest)
{
return repo_config_get_int(the_repository, key, dest);
diff --git a/connect.c b/connect.c
index 4b1dc65e5ce..34cac24d54c 100644
--- a/connect.c
+++ b/connect.c
@@ -1154,7 +1154,7 @@ static const char *get_ssh_command(void)
if ((ssh = getenv("GIT_SSH_COMMAND")))
return ssh;
- if (!git_config_get_string_tmp("core.sshcommand", &ssh))
+ if (!repo_config_get_string_tmp(the_repository, "core.sshcommand", &ssh))
return ssh;
return NULL;
@@ -1173,7 +1173,7 @@ static void override_ssh_variant(enum ssh_variant *ssh_variant)
{
const char *variant = getenv("GIT_SSH_VARIANT");
- if (!variant && git_config_get_string_tmp("ssh.variant", &variant))
+ if (!variant && repo_config_get_string_tmp(the_repository, "ssh.variant", &variant))
return;
if (!strcmp(variant, "auto"))
diff --git a/editor.c b/editor.c
index b79d97b0e72..fd174e6a034 100644
--- a/editor.c
+++ b/editor.c
@@ -50,7 +50,7 @@ const char *git_sequence_editor(void)
const char *editor = getenv("GIT_SEQUENCE_EDITOR");
if (!editor)
- git_config_get_string_tmp("sequence.editor", &editor);
+ repo_config_get_string_tmp(the_repository, "sequence.editor", &editor);
if (!editor)
editor = git_editor();
diff --git a/help.c b/help.c
index db62cda4442..bb20498cfd0 100644
--- a/help.c
+++ b/help.c
@@ -417,7 +417,7 @@ void list_cmds_by_config(struct string_list *list)
{
const char *cmd_list;
- if (git_config_get_string_tmp("completion.commands", &cmd_list))
+ if (repo_config_get_string_tmp(the_repository, "completion.commands", &cmd_list))
return;
string_list_sort(list);
diff --git a/promisor-remote.c b/promisor-remote.c
index be6f82d12f8..a9c877d9cfa 100644
--- a/promisor-remote.c
+++ b/promisor-remote.c
@@ -327,7 +327,7 @@ static void promisor_info_vecs(struct repository *repo,
char *url_key = xstrfmt("remote.%s.url", r->name);
/* Only add remotes with a non empty URL */
- if (!git_config_get_string_tmp(url_key, &url) && *url) {
+ if (!repo_config_get_string_tmp(the_repository, url_key, &url) && *url) {
strvec_push(names, r->name);
strvec_push(urls, url);
}
@@ -433,7 +433,7 @@ static void filter_promisor_remote(struct repository *repo,
struct strvec names = STRVEC_INIT;
struct strvec urls = STRVEC_INIT;
- if (!git_config_get_string_tmp("promisor.acceptfromserver", &accept_str)) {
+ if (!repo_config_get_string_tmp(the_repository, "promisor.acceptfromserver", &accept_str)) {
if (!*accept_str || !strcasecmp("None", accept_str))
accept = ACCEPT_NONE;
else if (!strcasecmp("KnownUrl", accept_str))
diff --git a/protocol.c b/protocol.c
index bae7226ff40..65f66217021 100644
--- a/protocol.c
+++ b/protocol.c
@@ -24,7 +24,7 @@ enum protocol_version get_protocol_version_config(void)
const char *git_test_k = "GIT_TEST_PROTOCOL_VERSION";
const char *git_test_v;
- if (!git_config_get_string_tmp("protocol.version", &value)) {
+ if (!repo_config_get_string_tmp(the_repository, "protocol.version", &value)) {
enum protocol_version version = parse_protocol_version(value);
if (version == protocol_unknown_version)
diff --git a/remote.c b/remote.c
index e965f022f12..88f991795b2 100644
--- a/remote.c
+++ b/remote.c
@@ -734,7 +734,7 @@ static void validate_remote_url(struct remote *remote)
struct strbuf redacted = STRBUF_INIT;
int warn_not_die;
- if (git_config_get_string_tmp("transfer.credentialsinurl", &value))
+ if (repo_config_get_string_tmp(the_repository, "transfer.credentialsinurl", &value))
return;
if (!strcmp("warn", value))
diff --git a/sideband.c b/sideband.c
index 251e9615ed0..8f15b98a654 100644
--- a/sideband.c
+++ b/sideband.c
@@ -39,9 +39,9 @@ static int use_sideband_colors(void)
if (use_sideband_colors_cached >= 0)
return use_sideband_colors_cached;
- if (!git_config_get_string_tmp(key, &value))
+ if (!repo_config_get_string_tmp(the_repository, key, &value))
use_sideband_colors_cached = git_config_colorbool(key, value);
- else if (!git_config_get_string_tmp("color.ui", &value))
+ else if (!repo_config_get_string_tmp(the_repository, "color.ui", &value))
use_sideband_colors_cached = git_config_colorbool("color.ui", value);
else
use_sideband_colors_cached = GIT_COLOR_AUTO;
@@ -49,7 +49,7 @@ static int use_sideband_colors(void)
for (i = 0; i < ARRAY_SIZE(keywords); i++) {
strbuf_reset(&sb);
strbuf_addf(&sb, "%s.%s", key, keywords[i].keyword);
- if (git_config_get_string_tmp(sb.buf, &value))
+ if (repo_config_get_string_tmp(the_repository, sb.buf, &value))
continue;
color_parse(value, keywords[i].color);
}
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 1953ab846e4..30e70f1a6c2 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -171,7 +171,7 @@ int cmd__config(int argc, const char **argv)
goto exit1;
}
} else if (argc == 3 && !strcmp(argv[1], "get_string")) {
- if (!git_config_get_string_tmp(argv[2], &v)) {
+ if (!repo_config_get_string_tmp(the_repository, argv[2], &v)) {
printf("%s\n", v);
goto exit0;
} else {
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 09/21] config: drop `git_config_get_int()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (7 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 08/21] " Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 10/21] config: drop `git_config_get_ulong()` wrapper Patrick Steinhardt
` (11 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_int()`. All
callsites are adjusted so that they use
`repo_config_get_int(the_repository, ...)` instead. While some callsites
might already have a repository available, this mechanical conversion is
the exact same as the current situation and thus cannot cause any
regression. Those sites should eventually be cleaned up in a later patch
series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/credential-store.c | 2 +-
builtin/fast-import.c | 6 +++---
builtin/fetch.c | 4 ++--
builtin/gc.c | 26 +++++++++++++-------------
config.h | 5 -----
fetch-pack.c | 4 ++--
fsmonitor.c | 2 +-
merge-ort.c | 6 +++---
parallel-checkout.c | 4 ++--
refs.c | 2 +-
refs/packed-backend.c | 2 +-
sequencer.c | 2 +-
t/helper/test-config.c | 2 +-
13 files changed, 31 insertions(+), 36 deletions(-)
diff --git a/builtin/credential-store.c b/builtin/credential-store.c
index e669e99dbfb..b74e06cc93d 100644
--- a/builtin/credential-store.c
+++ b/builtin/credential-store.c
@@ -66,7 +66,7 @@ static void rewrite_credential_file(const char *fn, struct credential *c,
{
int timeout_ms = 1000;
- git_config_get_int("credentialstore.locktimeoutms", &timeout_ms);
+ repo_config_get_int(the_repository, "credentialstore.locktimeoutms", &timeout_ms);
if (hold_lock_file_for_update_timeout(&credential_lock, fn, 0, timeout_ms) < 0)
die_errno(_("unable to get credential storage lock in %d ms"), timeout_ms);
if (extra)
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 607441e921b..9b0ae437148 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -3527,7 +3527,7 @@ static void git_pack_config(void)
if (max_depth > MAX_DEPTH)
max_depth = MAX_DEPTH;
}
- if (!git_config_get_int("pack.indexversion", &indexversion_value)) {
+ if (!repo_config_get_int(the_repository, "pack.indexversion", &indexversion_value)) {
pack_idx_opts.version = indexversion_value;
if (pack_idx_opts.version > 2)
git_die_config(the_repository, "pack.indexversion",
@@ -3536,9 +3536,9 @@ static void git_pack_config(void)
if (!git_config_get_ulong("pack.packsizelimit", &packsizelimit_value))
max_packsize = packsizelimit_value;
- if (!git_config_get_int("fastimport.unpacklimit", &limit))
+ if (!repo_config_get_int(the_repository, "fastimport.unpacklimit", &limit))
unpack_limit = limit;
- else if (!git_config_get_int("transfer.unpacklimit", &limit))
+ else if (!repo_config_get_int(the_repository, "transfer.unpacklimit", &limit))
unpack_limit = limit;
repo_config(the_repository, git_default_config, NULL);
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 52eae4b972d..24645c46533 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -2683,12 +2683,12 @@ int cmd_fetch(int argc,
* but respect config settings disabling it.
*/
int opt_val;
- if (git_config_get_int("gc.autopacklimit", &opt_val))
+ if (repo_config_get_int(the_repository, "gc.autopacklimit", &opt_val))
opt_val = -1;
if (opt_val != 0)
git_config_push_parameter("gc.autoPackLimit=1");
- if (git_config_get_int("maintenance.incremental-repack.auto", &opt_val))
+ if (repo_config_get_int(the_repository, "maintenance.incremental-repack.auto", &opt_val))
opt_val = -1;
if (opt_val != 0)
git_config_push_parameter("maintenance.incremental-repack.auto=-1");
diff --git a/builtin/gc.c b/builtin/gc.c
index a2b8fbc9f3d..cf175b8f1b7 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -189,10 +189,10 @@ static void gc_config(struct gc_config *cfg)
gc_config_is_timestamp_never("gc.reflogexpireunreachable"))
cfg->prune_reflogs = 0;
- git_config_get_int("gc.aggressivewindow", &cfg->aggressive_window);
- git_config_get_int("gc.aggressivedepth", &cfg->aggressive_depth);
- git_config_get_int("gc.auto", &cfg->gc_auto_threshold);
- git_config_get_int("gc.autopacklimit", &cfg->gc_auto_pack_limit);
+ repo_config_get_int(the_repository, "gc.aggressivewindow", &cfg->aggressive_window);
+ repo_config_get_int(the_repository, "gc.aggressivedepth", &cfg->aggressive_depth);
+ repo_config_get_int(the_repository, "gc.auto", &cfg->gc_auto_threshold);
+ repo_config_get_int(the_repository, "gc.autopacklimit", &cfg->gc_auto_pack_limit);
git_config_get_bool("gc.autodetach", &cfg->detach_auto);
git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs);
git_config_get_ulong("gc.maxcruftsize", &cfg->max_cruft_size);
@@ -332,7 +332,7 @@ static int reflog_expire_condition(struct gc_config *cfg UNUSED)
};
int limit = 100;
- git_config_get_int("maintenance.reflog-expire.auto", &limit);
+ repo_config_get_int(the_repository, "maintenance.reflog-expire.auto", &limit);
if (!limit)
return 0;
if (limit < 0)
@@ -378,7 +378,7 @@ static int worktree_prune_condition(struct gc_config *cfg)
struct dirent *d;
DIR *dir = NULL;
- git_config_get_int("maintenance.worktree-prune.auto", &limit);
+ repo_config_get_int(the_repository, "maintenance.worktree-prune.auto", &limit);
if (limit <= 0) {
should_prune = limit < 0;
goto out;
@@ -423,7 +423,7 @@ static int rerere_gc_condition(struct gc_config *cfg UNUSED)
int should_gc = 0, limit = 1;
DIR *dir = NULL;
- git_config_get_int("maintenance.rerere-gc.auto", &limit);
+ repo_config_get_int(the_repository, "maintenance.rerere-gc.auto", &limit);
if (limit <= 0) {
should_gc = limit < 0;
goto out;
@@ -1161,8 +1161,8 @@ static int should_write_commit_graph(struct gc_config *cfg UNUSED)
data.num_not_in_graph = 0;
data.limit = 100;
- git_config_get_int("maintenance.commit-graph.auto",
- &data.limit);
+ repo_config_get_int(the_repository, "maintenance.commit-graph.auto",
+ &data.limit);
if (!data.limit)
return 0;
@@ -1300,8 +1300,8 @@ static int loose_object_auto_condition(struct gc_config *cfg UNUSED)
{
int count = 0;
- git_config_get_int("maintenance.loose-objects.auto",
- &loose_object_auto_limit);
+ repo_config_get_int(the_repository, "maintenance.loose-objects.auto",
+ &loose_object_auto_limit);
if (!loose_object_auto_limit)
return 0;
@@ -1415,8 +1415,8 @@ static int incremental_repack_auto_condition(struct gc_config *cfg UNUSED)
if (!the_repository->settings.core_multi_pack_index)
return 0;
- git_config_get_int("maintenance.incremental-repack.auto",
- &incremental_repack_auto_limit);
+ repo_config_get_int(the_repository, "maintenance.incremental-repack.auto",
+ &incremental_repack_auto_limit);
if (!incremental_repack_auto_limit)
return 0;
diff --git a/config.h b/config.h
index 89739bee9b0..2490c47daaf 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_int(const char *key, int *dest)
-{
- return repo_config_get_int(the_repository, key, dest);
-}
-
static inline int git_config_get_ulong(const char *key, unsigned long *dest)
{
return repo_config_get_ulong(the_repository, key, dest);
diff --git a/fetch-pack.c b/fetch-pack.c
index 04768087879..1f184efb3c9 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1901,8 +1901,8 @@ static int fetch_pack_config_cb(const char *var, const char *value,
static void fetch_pack_config(void)
{
- git_config_get_int("fetch.unpacklimit", &fetch_unpack_limit);
- git_config_get_int("transfer.unpacklimit", &transfer_unpack_limit);
+ repo_config_get_int(the_repository, "fetch.unpacklimit", &fetch_unpack_limit);
+ repo_config_get_int(the_repository, "transfer.unpacklimit", &transfer_unpack_limit);
git_config_get_bool("repack.usedeltabaseoffset", &prefer_ofs_delta);
git_config_get_bool("fetch.fsckobjects", &fetch_fsck_objects);
git_config_get_bool("transfer.fsckobjects", &transfer_fsck_objects);
diff --git a/fsmonitor.c b/fsmonitor.c
index 98b2b476f08..d07dc18967a 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -43,7 +43,7 @@ static int fsmonitor_hook_version(void)
{
int hook_version;
- if (git_config_get_int("core.fsmonitorhookversion", &hook_version))
+ if (repo_config_get_int(the_repository, "core.fsmonitorhookversion", &hook_version))
return -1;
if (hook_version == HOOK_INTERFACE_VERSION1 ||
diff --git a/merge-ort.c b/merge-ort.c
index 29789579c9b..45fd41f8dfd 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -5353,9 +5353,9 @@ static void merge_recursive_config(struct merge_options *opt, int ui)
{
char *value = NULL;
int renormalize = 0;
- git_config_get_int("merge.verbosity", &opt->verbosity);
- git_config_get_int("diff.renamelimit", &opt->rename_limit);
- git_config_get_int("merge.renamelimit", &opt->rename_limit);
+ repo_config_get_int(the_repository, "merge.verbosity", &opt->verbosity);
+ repo_config_get_int(the_repository, "diff.renamelimit", &opt->rename_limit);
+ repo_config_get_int(the_repository, "merge.renamelimit", &opt->rename_limit);
git_config_get_bool("merge.renormalize", &renormalize);
opt->renormalize = renormalize;
if (!repo_config_get_string(the_repository, "diff.renames", &value)) {
diff --git a/parallel-checkout.c b/parallel-checkout.c
index 57c2dcaa8f6..fba6aa65a6e 100644
--- a/parallel-checkout.c
+++ b/parallel-checkout.c
@@ -57,12 +57,12 @@ void get_parallel_checkout_configs(int *num_workers, int *threshold)
return;
}
- if (git_config_get_int("checkout.workers", num_workers))
+ if (repo_config_get_int(the_repository, "checkout.workers", num_workers))
*num_workers = DEFAULT_NUM_WORKERS;
else if (*num_workers < 1)
*num_workers = online_cpus();
- if (git_config_get_int("checkout.thresholdForParallelism", threshold))
+ if (repo_config_get_int(the_repository, "checkout.thresholdForParallelism", threshold))
*threshold = DEFAULT_THRESHOLD_FOR_PARALLELISM;
}
diff --git a/refs.c b/refs.c
index 73913b6627b..777cbd34ebc 100644
--- a/refs.c
+++ b/refs.c
@@ -945,7 +945,7 @@ long get_files_ref_lock_timeout_ms(void)
static int timeout_ms = 100;
if (!configured) {
- git_config_get_int("core.filesreflocktimeout", &timeout_ms);
+ repo_config_get_int(the_repository, "core.filesreflocktimeout", &timeout_ms);
configured = 1;
}
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index 7fd73a0e6da..7dd26726b1e 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -1228,7 +1228,7 @@ int packed_refs_lock(struct ref_store *ref_store, int flags, struct strbuf *err)
static int timeout_value = 1000;
if (!timeout_configured) {
- git_config_get_int("core.packedrefstimeout", &timeout_value);
+ repo_config_get_int(the_repository, "core.packedrefstimeout", &timeout_value);
timeout_configured = 1;
}
diff --git a/sequencer.c b/sequencer.c
index f3bada39b40..f8d9bb69df8 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -5834,7 +5834,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,
*cmd_reset = abbr ? "t" : "reset",
*cmd_merge = abbr ? "m" : "merge";
- git_config_get_int("rebase.maxlabellength", &state.max_label_length);
+ repo_config_get_int(the_repository, "rebase.maxlabellength", &state.max_label_length);
oidmap_init(&commit2todo, 0);
oidmap_init(&state.commit2label, 0);
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 30e70f1a6c2..ce1e3330516 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -155,7 +155,7 @@ int cmd__config(int argc, const char **argv)
BUG("Key \"%s\" has unknown return %d", argv[2], ret);
goto exit1;
} else if (argc == 3 && !strcmp(argv[1], "get_int")) {
- if (!git_config_get_int(argv[2], &val)) {
+ if (!repo_config_get_int(the_repository, argv[2], &val)) {
printf("%d\n", val);
goto exit0;
} else {
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 10/21] config: drop `git_config_get_ulong()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (8 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 09/21] config: drop `git_config_get_int()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 11/21] config: drop `git_config_get_bool()` wrapper Patrick Steinhardt
` (10 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_ulong()`. All
callsites are adjusted so that they use
`repo_config_get_ulong(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/fast-import.c | 4 ++--
builtin/gc.c | 10 +++++-----
config.h | 5 -----
http-backend.c | 2 +-
4 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 9b0ae437148..a3f7f14f4fe 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -3523,7 +3523,7 @@ static void git_pack_config(void)
int limit;
unsigned long packsizelimit_value;
- if (!git_config_get_ulong("pack.depth", &max_depth)) {
+ if (!repo_config_get_ulong(the_repository, "pack.depth", &max_depth)) {
if (max_depth > MAX_DEPTH)
max_depth = MAX_DEPTH;
}
@@ -3533,7 +3533,7 @@ static void git_pack_config(void)
git_die_config(the_repository, "pack.indexversion",
"bad pack.indexVersion=%"PRIu32, pack_idx_opts.version);
}
- if (!git_config_get_ulong("pack.packsizelimit", &packsizelimit_value))
+ if (!repo_config_get_ulong(the_repository, "pack.packsizelimit", &packsizelimit_value))
max_packsize = packsizelimit_value;
if (!repo_config_get_int(the_repository, "fastimport.unpacklimit", &limit))
diff --git a/builtin/gc.c b/builtin/gc.c
index cf175b8f1b7..d15daf59625 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -195,7 +195,7 @@ static void gc_config(struct gc_config *cfg)
repo_config_get_int(the_repository, "gc.autopacklimit", &cfg->gc_auto_pack_limit);
git_config_get_bool("gc.autodetach", &cfg->detach_auto);
git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs);
- git_config_get_ulong("gc.maxcruftsize", &cfg->max_cruft_size);
+ repo_config_get_ulong(the_repository, "gc.maxcruftsize", &cfg->max_cruft_size);
if (!repo_config_get_expiry(the_repository, "gc.pruneexpire", &owned)) {
free(cfg->prune_expire);
@@ -212,10 +212,10 @@ static void gc_config(struct gc_config *cfg)
cfg->gc_log_expire = owned;
}
- git_config_get_ulong("gc.bigpackthreshold", &cfg->big_pack_threshold);
- git_config_get_ulong("pack.deltacachesize", &cfg->max_delta_cache_size);
+ repo_config_get_ulong(the_repository, "gc.bigpackthreshold", &cfg->big_pack_threshold);
+ repo_config_get_ulong(the_repository, "pack.deltacachesize", &cfg->max_delta_cache_size);
- if (!git_config_get_ulong("core.deltabasecachelimit", &ulongval))
+ if (!repo_config_get_ulong(the_repository, "core.deltabasecachelimit", &ulongval))
cfg->delta_base_cache_limit = ulongval;
if (!repo_config_get_string(the_repository, "gc.repackfilter", &owned)) {
@@ -2344,7 +2344,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
die(_("failed to create directories for '%s'"), filename);
if ((long)lock_file_timeout_ms < 0 &&
- git_config_get_ulong("gc.launchctlplistlocktimeoutms",
+ repo_config_get_ulong(the_repository, "gc.launchctlplistlocktimeoutms",
&lock_file_timeout_ms))
lock_file_timeout_ms = 150;
diff --git a/config.h b/config.h
index 2490c47daaf..e22c07a4488 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_ulong(const char *key, unsigned long *dest)
-{
- return repo_config_get_ulong(the_repository, key, dest);
-}
-
static inline int git_config_get_bool(const char *key, int *dest)
{
return repo_config_get_bool(the_repository, key, dest);
diff --git a/http-backend.c b/http-backend.c
index ad8c4037493..3d5d5a84646 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -247,7 +247,7 @@ static void http_config(void)
struct strbuf var = STRBUF_INIT;
git_config_get_bool("http.getanyfile", &getanyfile);
- git_config_get_ulong("http.maxrequestbuffer", &max_request_buffer);
+ repo_config_get_ulong(the_repository, "http.maxrequestbuffer", &max_request_buffer);
for (i = 0; i < ARRAY_SIZE(rpc_service); i++) {
struct rpc_service *svc = &rpc_service[i];
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 11/21] config: drop `git_config_get_bool()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (9 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 10/21] config: drop `git_config_get_ulong()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 12/21] config: drop `git_config_set_in_file()` wrapper Patrick Steinhardt
` (9 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_bool()`. All
callsites are adjusted so that they use
`repo_config_get_bool(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
archive.c | 2 +-
builtin/am.c | 8 ++++----
builtin/checkout.c | 2 +-
builtin/clone.c | 2 +-
builtin/credential-cache--daemon.c | 2 +-
builtin/gc.c | 6 +++---
builtin/grep.c | 2 +-
builtin/rebase.c | 2 +-
compat/precompose_utf8.c | 2 +-
config.h | 5 -----
daemon.c | 2 +-
fetch-pack.c | 8 ++++----
http-backend.c | 4 ++--
merge-ort.c | 2 +-
promisor-remote.c | 4 ++--
read-cache.c | 4 ++--
rerere.c | 4 ++--
run-command.c | 6 +++---
setup.c | 2 +-
t/helper/test-config.c | 2 +-
transport.c | 2 +-
21 files changed, 34 insertions(+), 39 deletions(-)
diff --git a/archive.c b/archive.c
index 2dd306a07a7..310672b479a 100644
--- a/archive.c
+++ b/archive.c
@@ -760,7 +760,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
const char **argv_copy;
int rc;
- git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable);
+ repo_config_get_bool(the_repository, "uploadarchive.allowunreachable", &remote_allow_unreachable);
repo_config(the_repository, git_default_config, NULL);
describe_status.max_invocations = 1;
diff --git a/builtin/am.c b/builtin/am.c
index a7e7cf1465a..6073d64ae97 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -162,18 +162,18 @@ static void am_state_init(struct am_state *state)
state->prec = 4;
- git_config_get_bool("am.threeway", &state->threeway);
+ repo_config_get_bool(the_repository, "am.threeway", &state->threeway);
state->utf8 = 1;
- git_config_get_bool("am.messageid", &state->message_id);
+ repo_config_get_bool(the_repository, "am.messageid", &state->message_id);
state->scissors = SCISSORS_UNSET;
state->quoted_cr = quoted_cr_unset;
strvec_init(&state->git_apply_opts);
- if (!git_config_get_bool("commit.gpgsign", &gpgsign))
+ if (!repo_config_get_bool(the_repository, "commit.gpgsign", &gpgsign))
state->sign_commit = gpgsign ? "" : NULL;
}
@@ -965,7 +965,7 @@ static int split_mail(struct am_state *state, enum patch_format patch_format,
{
if (keep_cr < 0) {
keep_cr = 0;
- git_config_get_bool("am.keepcr", &keep_cr);
+ repo_config_get_bool(the_repository, "am.keepcr", &keep_cr);
}
switch (patch_format) {
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 948ff7bdda7..37efde59898 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -291,7 +291,7 @@ static int checkout_merged(int pos, const struct checkout *state,
read_mmblob(&ours, &threeway[1]);
read_mmblob(&theirs, &threeway[2]);
- git_config_get_bool("merge.renormalize", &renormalize);
+ repo_config_get_bool(the_repository, "merge.renormalize", &renormalize);
ll_opts.renormalize = renormalize;
ll_opts.conflict_style = conflict_style;
merge_status = ll_merge(&result_buf, path, &ancestor, "base",
diff --git a/builtin/clone.c b/builtin/clone.c
index 3c6d8529b6c..34eea11db4d 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -1150,7 +1150,7 @@ int cmd_clone(int argc,
strbuf_reset(&sb);
}
- if (!git_config_get_bool("submodule.stickyRecursiveClone", &val) &&
+ if (!repo_config_get_bool(the_repository, "submodule.stickyRecursiveClone", &val) &&
val)
string_list_append(&option_config, "submodule.recurse=true");
diff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c
index 5065ff4660b..65cc619bec2 100644
--- a/builtin/credential-cache--daemon.c
+++ b/builtin/credential-cache--daemon.c
@@ -307,7 +307,7 @@ int cmd_credential_cache_daemon(int argc,
OPT_END()
};
- git_config_get_bool("credentialcache.ignoresighup", &ignore_sighup);
+ repo_config_get_bool(the_repository, "credentialcache.ignoresighup", &ignore_sighup);
argc = parse_options(argc, argv, prefix, options, usage, 0);
socket_path = argv[0];
diff --git a/builtin/gc.c b/builtin/gc.c
index d15daf59625..fa62e4f2627 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -193,8 +193,8 @@ static void gc_config(struct gc_config *cfg)
repo_config_get_int(the_repository, "gc.aggressivedepth", &cfg->aggressive_depth);
repo_config_get_int(the_repository, "gc.auto", &cfg->gc_auto_threshold);
repo_config_get_int(the_repository, "gc.autopacklimit", &cfg->gc_auto_pack_limit);
- git_config_get_bool("gc.autodetach", &cfg->detach_auto);
- git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs);
+ repo_config_get_bool(the_repository, "gc.autodetach", &cfg->detach_auto);
+ repo_config_get_bool(the_repository, "gc.cruftpacks", &cfg->cruft_packs);
repo_config_get_ulong(the_repository, "gc.maxcruftsize", &cfg->max_cruft_size);
if (!repo_config_get_expiry(the_repository, "gc.pruneexpire", &owned)) {
@@ -1779,7 +1779,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,
strbuf_reset(&config_name);
strbuf_addf(&config_name, "maintenance.%s.enabled",
tasks[i].name);
- if (!git_config_get_bool(config_name.buf, &config_value))
+ if (!repo_config_get_bool(the_repository, config_name.buf, &config_value))
strategy.tasks[i].enabled = config_value;
if (!strategy.tasks[i].enabled)
continue;
diff --git a/builtin/grep.c b/builtin/grep.c
index 7982dda9a3b..8fcb69dbf2c 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -1058,7 +1058,7 @@ int cmd_grep(int argc,
if (use_index && !startup_info->have_repository) {
int fallback = 0;
- git_config_get_bool("grep.fallbacktonoindex", &fallback);
+ repo_config_get_bool(the_repository, "grep.fallbacktonoindex", &fallback);
if (fallback)
use_index = 0;
else
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 0c3daa4b814..72a52bdfb98 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -340,7 +340,7 @@ static int run_sequencer_rebase(struct rebase_options *opts)
unsigned flags = 0;
int abbreviate_commands = 0, ret = 0;
- git_config_get_bool("rebase.abbreviatecommands", &abbreviate_commands);
+ repo_config_get_bool(the_repository, "rebase.abbreviatecommands", &abbreviate_commands);
flags |= opts->keep_empty ? TODO_LIST_KEEP_EMPTY : 0;
flags |= abbreviate_commands ? TODO_LIST_ABBREVIATE_CMDS : 0;
diff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c
index 12e38e0ea3c..3985ed108eb 100644
--- a/compat/precompose_utf8.c
+++ b/compat/precompose_utf8.c
@@ -75,7 +75,7 @@ const char *precompose_string_if_needed(const char *in)
iconv_t ic_prec;
char *out;
if (precomposed_unicode < 0)
- git_config_get_bool("core.precomposeunicode", &precomposed_unicode);
+ repo_config_get_bool(the_repository, "core.precomposeunicode", &precomposed_unicode);
if (precomposed_unicode != 1)
return in;
ic_prec = iconv_open(repo_encoding, path_encoding);
diff --git a/config.h b/config.h
index e22c07a4488..c9f582c7c55 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_bool(const char *key, int *dest)
-{
- return repo_config_get_bool(the_repository, key, dest);
-}
-
static inline int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest)
{
return repo_config_get_bool_or_int(the_repository, key, is_bool, dest);
diff --git a/daemon.c b/daemon.c
index 61cd50f7200..cb209235557 100644
--- a/daemon.c
+++ b/daemon.c
@@ -402,7 +402,7 @@ static int run_service(const char *dir, struct daemon_service *service,
if (service->overridable) {
strbuf_addf(&var, "daemon.%s", service->config_name);
- git_config_get_bool(var.buf, &enabled);
+ repo_config_get_bool(the_repository, var.buf, &enabled);
strbuf_release(&var);
}
if (!enabled) {
diff --git a/fetch-pack.c b/fetch-pack.c
index 1f184efb3c9..94b1436c5c2 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1903,10 +1903,10 @@ static void fetch_pack_config(void)
{
repo_config_get_int(the_repository, "fetch.unpacklimit", &fetch_unpack_limit);
repo_config_get_int(the_repository, "transfer.unpacklimit", &transfer_unpack_limit);
- git_config_get_bool("repack.usedeltabaseoffset", &prefer_ofs_delta);
- git_config_get_bool("fetch.fsckobjects", &fetch_fsck_objects);
- git_config_get_bool("transfer.fsckobjects", &transfer_fsck_objects);
- git_config_get_bool("transfer.advertisesid", &advertise_sid);
+ repo_config_get_bool(the_repository, "repack.usedeltabaseoffset", &prefer_ofs_delta);
+ repo_config_get_bool(the_repository, "fetch.fsckobjects", &fetch_fsck_objects);
+ repo_config_get_bool(the_repository, "transfer.fsckobjects", &transfer_fsck_objects);
+ repo_config_get_bool(the_repository, "transfer.advertisesid", &advertise_sid);
if (!uri_protocols.nr) {
char *str;
diff --git a/http-backend.c b/http-backend.c
index 3d5d5a84646..d5dfe762bb5 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -246,13 +246,13 @@ static void http_config(void)
int i, value = 0;
struct strbuf var = STRBUF_INIT;
- git_config_get_bool("http.getanyfile", &getanyfile);
+ repo_config_get_bool(the_repository, "http.getanyfile", &getanyfile);
repo_config_get_ulong(the_repository, "http.maxrequestbuffer", &max_request_buffer);
for (i = 0; i < ARRAY_SIZE(rpc_service); i++) {
struct rpc_service *svc = &rpc_service[i];
strbuf_addf(&var, "http.%s", svc->config_name);
- if (!git_config_get_bool(var.buf, &value))
+ if (!repo_config_get_bool(the_repository, var.buf, &value))
svc->enabled = value;
strbuf_reset(&var);
}
diff --git a/merge-ort.c b/merge-ort.c
index 45fd41f8dfd..86896ff11b0 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -5356,7 +5356,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)
repo_config_get_int(the_repository, "merge.verbosity", &opt->verbosity);
repo_config_get_int(the_repository, "diff.renamelimit", &opt->rename_limit);
repo_config_get_int(the_repository, "merge.renamelimit", &opt->rename_limit);
- git_config_get_bool("merge.renormalize", &renormalize);
+ repo_config_get_bool(the_repository, "merge.renormalize", &renormalize);
opt->renormalize = renormalize;
if (!repo_config_get_string(the_repository, "diff.renames", &value)) {
opt->detect_renames = git_config_rename("diff.renames", value);
diff --git a/promisor-remote.c b/promisor-remote.c
index a9c877d9cfa..08b0da89622 100644
--- a/promisor-remote.c
+++ b/promisor-remote.c
@@ -46,7 +46,7 @@ static int fetch_objects(struct repository *repo,
"fetch", remote_name, "--no-tags",
"--no-write-fetch-head", "--recurse-submodules=no",
"--filter=blob:none", "--stdin", NULL);
- if (!git_config_get_bool("promisor.quiet", &quiet) && quiet)
+ if (!repo_config_get_bool(the_repository, "promisor.quiet", &quiet) && quiet)
strvec_push(&child.args, "--quiet");
if (start_command(&child))
die(_("promisor-remote: unable to fork off fetch subprocess"));
@@ -343,7 +343,7 @@ char *promisor_remote_info(struct repository *repo)
struct strvec names = STRVEC_INIT;
struct strvec urls = STRVEC_INIT;
- git_config_get_bool("promisor.advertise", &advertise_promisors);
+ repo_config_get_bool(the_repository, "promisor.advertise", &advertise_promisors);
if (!advertise_promisors)
return NULL;
diff --git a/read-cache.c b/read-cache.c
index 5cf41b81f1f..4fdde758d1b 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2755,7 +2755,7 @@ static int record_eoie(void)
{
int val;
- if (!git_config_get_bool("index.recordendofindexentries", &val))
+ if (!repo_config_get_bool(the_repository, "index.recordendofindexentries", &val))
return val;
/*
@@ -2770,7 +2770,7 @@ static int record_ieot(void)
{
int val;
- if (!git_config_get_bool("index.recordoffsettable", &val))
+ if (!repo_config_get_bool(the_repository, "index.recordoffsettable", &val))
return val;
/*
diff --git a/rerere.c b/rerere.c
index 1ac2075144c..c7c3e535ce5 100644
--- a/rerere.c
+++ b/rerere.c
@@ -877,8 +877,8 @@ static int do_plain_rerere(struct repository *r,
static void git_rerere_config(void)
{
- git_config_get_bool("rerere.enabled", &rerere_enabled);
- git_config_get_bool("rerere.autoupdate", &rerere_autoupdate);
+ repo_config_get_bool(the_repository, "rerere.enabled", &rerere_enabled);
+ repo_config_get_bool(the_repository, "rerere.autoupdate", &rerere_autoupdate);
repo_config(the_repository, git_default_config, NULL);
}
diff --git a/run-command.c b/run-command.c
index 8833b233678..ed9575bd6a8 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1817,7 +1817,7 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint)
{
int enabled, auto_detach;
- if (!git_config_get_bool("maintenance.auto", &enabled) &&
+ if (!repo_config_get_bool(the_repository, "maintenance.auto", &enabled) &&
!enabled)
return 0;
@@ -1826,8 +1826,8 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint)
* honoring `gc.autoDetach`. This is somewhat weird, but required to
* retain behaviour from when we used to run git-gc(1) here.
*/
- if (git_config_get_bool("maintenance.autodetach", &auto_detach) &&
- git_config_get_bool("gc.autodetach", &auto_detach))
+ if (repo_config_get_bool(the_repository, "maintenance.autodetach", &auto_detach) &&
+ repo_config_get_bool(the_repository, "gc.autodetach", &auto_detach))
auto_detach = 1;
maint->git_cmd = 1;
diff --git a/setup.c b/setup.c
index 9661c5d5d5d..a06bb921b3a 100644
--- a/setup.c
+++ b/setup.c
@@ -1877,7 +1877,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
* the core.precomposeunicode configuration, this
* has to happen after the above block that finds
* out where the repository is, i.e. a preparation
- * for calling git_config_get_bool().
+ * for calling repo_config_get_bool().
*/
if (prefix) {
prefix = precompose_string_if_needed(prefix);
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index ce1e3330516..9f8cca7c48c 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -163,7 +163,7 @@ int cmd__config(int argc, const char **argv)
goto exit1;
}
} else if (argc == 3 && !strcmp(argv[1], "get_bool")) {
- if (!git_config_get_bool(argv[2], &val)) {
+ if (!repo_config_get_bool(the_repository, argv[2], &val)) {
printf("%d\n", val);
goto exit0;
} else {
diff --git a/transport.c b/transport.c
index 89e6297ce22..e305d6bd228 100644
--- a/transport.c
+++ b/transport.c
@@ -1602,7 +1602,7 @@ int transport_get_remote_bundle_uri(struct transport *transport)
* Don't request bundle-uri from the server unless configured to
* do so by the transfer.bundleURI=true config option.
*/
- if (git_config_get_bool("transfer.bundleuri", &value) || !value)
+ if (repo_config_get_bool(the_repository, "transfer.bundleuri", &value) || !value)
return 0;
if (!transport->bundles->baseURI)
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 12/21] config: drop `git_config_set_in_file()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (10 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 11/21] config: drop `git_config_get_bool()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 13/21] config: drop `git_config_set_gently()` wrapper Patrick Steinhardt
` (8 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_set_in_file()`.
All callsites are adjusted so that they use
`repo_config_set_in_file(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/submodule--helper.c | 10 +++++-----
config.h | 6 ------
dir.c | 4 ++--
3 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index d2ab31835b5..0be737ac4ff 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1810,12 +1810,12 @@ static int clone_submodule(const struct module_clone_data *clone_data,
/* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */
repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate);
if (sm_alternate)
- git_config_set_in_file(p, "submodule.alternateLocation",
- sm_alternate);
+ repo_config_set_in_file(the_repository, p, "submodule.alternateLocation",
+ sm_alternate);
repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy);
if (error_strategy)
- git_config_set_in_file(p, "submodule.alternateErrorStrategy",
- error_strategy);
+ repo_config_set_in_file(the_repository, p, "submodule.alternateErrorStrategy",
+ error_strategy);
free(sm_alternate);
free(error_strategy);
@@ -2522,7 +2522,7 @@ static int ensure_core_worktree(const char *path)
abs_path = absolute_pathdup(path);
rel_path = relative_path(abs_path, subrepo.gitdir, &sb);
- git_config_set_in_file(cfg_file, "core.worktree", rel_path);
+ repo_config_set_in_file(the_repository, cfg_file, "core.worktree", rel_path);
free(cfg_file);
free(abs_path);
diff --git a/config.h b/config.h
index c9f582c7c55..b4f79d4d4cc 100644
--- a/config.h
+++ b/config.h
@@ -734,12 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)
return repo_config_get_pathname(the_repository, key, dest);
}
-static inline void git_config_set_in_file(const char *config_filename,
- const char *key, const char *value)
-{
- repo_config_set_in_file(the_repository, config_filename, key, value);
-}
-
static inline int git_config_set_gently(const char *key, const char *value)
{
return repo_config_set_gently(the_repository, key, value);
diff --git a/dir.c b/dir.c
index 02873f59ea6..dfb4d40103f 100644
--- a/dir.c
+++ b/dir.c
@@ -4091,8 +4091,8 @@ void connect_work_tree_and_git_dir(const char *work_tree_,
write_file(gitfile_sb.buf, "gitdir: %s",
relative_path(git_dir, work_tree, &rel_path));
/* Update core.worktree setting */
- git_config_set_in_file(cfg_sb.buf, "core.worktree",
- relative_path(work_tree, git_dir, &rel_path));
+ repo_config_set_in_file(the_repository, cfg_sb.buf, "core.worktree",
+ relative_path(work_tree, git_dir, &rel_path));
strbuf_release(&gitfile_sb);
strbuf_release(&cfg_sb);
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 13/21] config: drop `git_config_set_gently()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (11 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 12/21] config: drop `git_config_set_in_file()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 14/21] config: drop `git_config_set()` wrapper Patrick Steinhardt
` (7 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_set_gently()`.
All callsites are adjusted so that they use
`repo_config_set_gently(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
branch.c | 6 +++---
builtin/clone.c | 2 +-
builtin/remote.c | 8 ++++----
builtin/submodule--helper.c | 14 +++++++-------
config.h | 5 -----
scalar.c | 4 ++--
setup.c | 4 ++--
worktree.c | 4 ++--
8 files changed, 21 insertions(+), 26 deletions(-)
diff --git a/branch.c b/branch.c
index b4811671fc7..3dc237adf6c 100644
--- a/branch.c
+++ b/branch.c
@@ -116,7 +116,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
}
strbuf_addf(&key, "branch.%s.remote", local);
- if (git_config_set_gently(key.buf, origin ? origin : ".") < 0)
+ if (repo_config_set_gently(the_repository, key.buf, origin ? origin : ".") < 0)
goto out_err;
strbuf_reset(&key);
@@ -127,7 +127,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
* more than one is provided, use CONFIG_REGEX_NONE to preserve what
* we've written so far.
*/
- if (git_config_set_gently(key.buf, NULL) < 0)
+ if (repo_config_set_gently(the_repository, key.buf, NULL) < 0)
goto out_err;
for_each_string_list_item(item, remotes)
if (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
@@ -136,7 +136,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
if (rebasing) {
strbuf_reset(&key);
strbuf_addf(&key, "branch.%s.rebase", local);
- if (git_config_set_gently(key.buf, "true") < 0)
+ if (repo_config_set_gently(the_repository, key.buf, "true") < 0)
goto out_err;
}
strbuf_release(&key);
diff --git a/builtin/clone.c b/builtin/clone.c
index 34eea11db4d..0d7dd5e8ec9 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -1467,7 +1467,7 @@ int cmd_clone(int argc,
warning(_("failed to fetch objects from bundle URI '%s'"),
bundle_uri);
else if (has_heuristic)
- git_config_set_gently("fetch.bundleuri", bundle_uri);
+ repo_config_set_gently(the_repository, "fetch.bundleuri", bundle_uri);
remote_state_clear(the_repository->remote_state);
free(the_repository->remote_state);
diff --git a/builtin/remote.c b/builtin/remote.c
index 826b2dcfd04..5c4dfc98afa 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -694,8 +694,8 @@ static void handle_push_default(const char* old_name, const char* new_name)
if (push_default.scope >= CONFIG_SCOPE_COMMAND)
; /* pass */
else if (push_default.scope >= CONFIG_SCOPE_LOCAL) {
- int result = git_config_set_gently("remote.pushDefault",
- new_name);
+ int result = repo_config_set_gently(the_repository, "remote.pushDefault",
+ new_name);
if (new_name && result && result != CONFIG_NOTHING_SET)
die(_("could not set '%s'"), "remote.pushDefault");
else if (!new_name && result && result != CONFIG_NOTHING_SET)
@@ -934,7 +934,7 @@ static int rm(int argc, const char **argv, const char *prefix,
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.%s",
item->string, *k);
- result = git_config_set_gently(buf.buf, NULL);
+ result = repo_config_set_gently(the_repository, buf.buf, NULL);
if (result && result != CONFIG_NOTHING_SET)
die(_("could not unset '%s'"), buf.buf);
}
@@ -942,7 +942,7 @@ static int rm(int argc, const char **argv, const char *prefix,
if (info->push_remote_name && !strcmp(info->push_remote_name, remote->name)) {
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.pushremote", item->string);
- result = git_config_set_gently(buf.buf, NULL);
+ result = repo_config_set_gently(the_repository, buf.buf, NULL);
if (result && result != CONFIG_NOTHING_SET)
die(_("could not unset '%s'"), buf.buf);
}
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 0be737ac4ff..710a2a2004e 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -458,7 +458,7 @@ static void init_submodule(const char *path, const char *prefix,
*/
if (!is_submodule_active(the_repository, path)) {
strbuf_addf(&sb, "submodule.%s.active", sub->name);
- git_config_set_gently(sb.buf, "true");
+ repo_config_set_gently(the_repository, sb.buf, "true");
strbuf_reset(&sb);
}
@@ -484,7 +484,7 @@ static void init_submodule(const char *path, const char *prefix,
free(oldurl);
}
- if (git_config_set_gently(sb.buf, url))
+ if (repo_config_set_gently(the_repository, sb.buf, url))
die(_("Failed to register url for submodule path '%s'"),
displaypath);
if (!(flags & OPT_QUIET))
@@ -506,7 +506,7 @@ static void init_submodule(const char *path, const char *prefix,
upd = submodule_update_type_to_string(sub->update_strategy.type);
}
- if (git_config_set_gently(sb.buf, upd))
+ if (repo_config_set_gently(the_repository, sb.buf, upd))
die(_("Failed to register update mode for submodule path '%s'"), displaypath);
}
strbuf_release(&sb);
@@ -1262,7 +1262,7 @@ static void sync_submodule(const char *path, const char *prefix,
strbuf_reset(&sb);
strbuf_addf(&sb, "submodule.%s.url", sub->name);
- if (git_config_set_gently(sb.buf, super_config_url))
+ if (repo_config_set_gently(the_repository, sb.buf, super_config_url))
die(_("failed to register url for submodule path '%s'"),
displaypath);
@@ -3309,7 +3309,7 @@ static void configure_added_submodule(struct add_data *add_data)
struct child_process add_gitmodules = CHILD_PROCESS_INIT;
key = xstrfmt("submodule.%s.url", add_data->sm_name);
- git_config_set_gently(key, add_data->realrepo);
+ repo_config_set_gently(the_repository, key, add_data->realrepo);
free(key);
add_submod.git_cmd = 1;
@@ -3356,12 +3356,12 @@ static void configure_added_submodule(struct add_data *add_data)
*/
if (!is_submodule_active(the_repository, add_data->sm_path)) {
key = xstrfmt("submodule.%s.active", add_data->sm_name);
- git_config_set_gently(key, "true");
+ repo_config_set_gently(the_repository, key, "true");
free(key);
}
} else {
key = xstrfmt("submodule.%s.active", add_data->sm_name);
- git_config_set_gently(key, "true");
+ repo_config_set_gently(the_repository, key, "true");
free(key);
}
}
diff --git a/config.h b/config.h
index b4f79d4d4cc..90977441c3b 100644
--- a/config.h
+++ b/config.h
@@ -734,11 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)
return repo_config_get_pathname(the_repository, key, dest);
}
-static inline int git_config_set_gently(const char *key, const char *value)
-{
- return repo_config_set_gently(the_repository, key, value);
-}
-
static inline void git_config_set(const char *key, const char *value)
{
repo_config_set(the_repository, key, value);
diff --git a/scalar.c b/scalar.c
index 07f855c9913..c09c5ca194e 100644
--- a/scalar.c
+++ b/scalar.c
@@ -103,7 +103,7 @@ static int set_scalar_config(const struct scalar_config *config, int reconfigure
if ((reconfigure && config->overwrite_on_reconfigure) ||
repo_config_get_string(the_repository, config->key, &value)) {
trace2_data_string("scalar", the_repository, config->key, "created");
- res = git_config_set_gently(config->key, config->value);
+ res = repo_config_set_gently(the_repository, config->key, config->value);
} else {
trace2_data_string("scalar", the_repository, config->key, "exists");
res = 0;
@@ -322,7 +322,7 @@ static int set_config(const char *fmt, ...)
value = strchr(buf.buf, '=');
if (value)
*(value++) = '\0';
- res = git_config_set_gently(buf.buf, value);
+ res = repo_config_set_gently(the_repository, buf.buf, value);
strbuf_release(&buf);
return res;
diff --git a/setup.c b/setup.c
index a06bb921b3a..a05c348dcdf 100644
--- a/setup.c
+++ b/setup.c
@@ -2236,13 +2236,13 @@ void initialize_repository_version(int hash_algo,
git_config_set("extensions.objectformat",
hash_algos[hash_algo].name);
else if (reinit)
- git_config_set_gently("extensions.objectformat", NULL);
+ repo_config_set_gently(the_repository, "extensions.objectformat", NULL);
if (ref_storage_format != REF_STORAGE_FORMAT_FILES)
git_config_set("extensions.refstorage",
ref_storage_format_to_name(ref_storage_format));
else if (reinit)
- git_config_set_gently("extensions.refstorage", NULL);
+ repo_config_set_gently(the_repository, "extensions.refstorage", NULL);
if (reinit) {
struct strbuf config = STRBUF_INIT;
diff --git a/worktree.c b/worktree.c
index c34b9eb74e5..981a2713374 100644
--- a/worktree.c
+++ b/worktree.c
@@ -1013,7 +1013,7 @@ int init_worktree_config(struct repository *r)
*/
if (r->repository_format_worktree_config)
return 0;
- if ((res = git_config_set_gently("extensions.worktreeConfig", "true")))
+ if ((res = repo_config_set_gently(the_repository, "extensions.worktreeConfig", "true")))
return error(_("failed to set extensions.worktreeConfig setting"));
common_config_file = xstrfmt("%s/config", r->commondir);
@@ -1077,7 +1077,7 @@ void write_worktree_linking_files(struct strbuf dotgit, struct strbuf gitdir,
if (use_relative_paths && !the_repository->repository_format_relative_worktrees) {
if (upgrade_repository_format(1) < 0)
die(_("unable to upgrade repository format to support relative worktrees"));
- if (git_config_set_gently("extensions.relativeWorktrees", "true"))
+ if (repo_config_set_gently(the_repository, "extensions.relativeWorktrees", "true"))
die(_("unable to set extensions.relativeWorktrees setting"));
the_repository->repository_format_relative_worktrees = 1;
}
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 14/21] config: drop `git_config_set()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (12 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 13/21] config: drop `git_config_set_gently()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 15/21] config: drop `git_config_set_in_file_gently()` wrapper Patrick Steinhardt
` (6 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_set()`. All
callsites are adjusted so that they use `repo_config_set(the_repository,
...)` instead. While some callsites might already have a repository
available, this mechanical conversion is the exact same as the current
situation and thus cannot cause any regression. Those sites should
eventually be cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/branch.c | 2 +-
builtin/clone.c | 8 ++++----
builtin/gc.c | 4 ++--
builtin/remote.c | 16 ++++++++--------
compat/precompose_utf8.c | 4 ++--
config.c | 2 +-
config.h | 5 -----
list-objects-filter-options.c | 6 +++---
setup.c | 30 +++++++++++++++---------------
9 files changed, 36 insertions(+), 41 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index 08e50bf77b3..5de0691d18d 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -699,7 +699,7 @@ static int edit_branch_description(const char *branch_name)
strbuf_addf(&name, "branch.%s.description", branch_name);
if (buf.len || exists)
- git_config_set(name.buf, buf.len ? buf.buf : NULL);
+ repo_config_set(the_repository, name.buf, buf.len ? buf.buf : NULL);
strbuf_release(&name);
strbuf_release(&buf);
diff --git a/builtin/clone.c b/builtin/clone.c
index 0d7dd5e8ec9..f025a8f19e0 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -827,7 +827,7 @@ static void write_refspec_config(const char *src_ref_prefix,
if (option_mirror) {
strbuf_addf(&key, "remote.%s.mirror", remote_name);
- git_config_set(key.buf, "true");
+ repo_config_set(the_repository, key.buf, "true");
strbuf_reset(&key);
}
}
@@ -1294,18 +1294,18 @@ int cmd_clone(int argc,
src_ref_prefix = "refs/";
strbuf_addstr(&branch_top, src_ref_prefix);
- git_config_set("core.bare", "true");
+ repo_config_set(the_repository, "core.bare", "true");
} else if (!option_rev) {
strbuf_addf(&branch_top, "refs/remotes/%s/", remote_name);
}
strbuf_addf(&key, "remote.%s.url", remote_name);
- git_config_set(key.buf, repo);
+ repo_config_set(the_repository, key.buf, repo);
strbuf_reset(&key);
if (!option_tags) {
strbuf_addf(&key, "remote.%s.tagOpt", remote_name);
- git_config_set(key.buf, "--no-tags");
+ repo_config_set(the_repository, key.buf, "--no-tags");
strbuf_reset(&key);
}
diff --git a/builtin/gc.c b/builtin/gc.c
index fa62e4f2627..c0fe4e73087 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1913,11 +1913,11 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
options);
/* Disable foreground maintenance */
- git_config_set("maintenance.auto", "false");
+ repo_config_set(the_repository, "maintenance.auto", "false");
/* Set maintenance strategy, if unset */
if (repo_config_get(the_repository, "maintenance.strategy"))
- git_config_set("maintenance.strategy", "incremental");
+ repo_config_set(the_repository, "maintenance.strategy", "incremental");
if (!repo_config_get_string_multi(the_repository, key, &list)) {
for_each_string_list_item(item, list) {
diff --git a/builtin/remote.c b/builtin/remote.c
index 5c4dfc98afa..827639e0398 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -209,7 +209,7 @@ static int add(int argc, const char **argv, const char *prefix,
die(_("'%s' is not a valid remote name"), name);
strbuf_addf(&buf, "remote.%s.url", name);
- git_config_set(buf.buf, url);
+ repo_config_set(the_repository, buf.buf, url);
if (!mirror || mirror & MIRROR_FETCH) {
strbuf_reset(&buf);
@@ -225,14 +225,14 @@ static int add(int argc, const char **argv, const char *prefix,
if (mirror & MIRROR_PUSH) {
strbuf_reset(&buf);
strbuf_addf(&buf, "remote.%s.mirror", name);
- git_config_set(buf.buf, "true");
+ repo_config_set(the_repository, buf.buf, "true");
}
if (fetch_tags != TAGS_DEFAULT) {
strbuf_reset(&buf);
strbuf_addf(&buf, "remote.%s.tagOpt", name);
- git_config_set(buf.buf,
- fetch_tags == TAGS_SET ? "--tags" : "--no-tags");
+ repo_config_set(the_repository, buf.buf,
+ fetch_tags == TAGS_SET ? "--tags" : "--no-tags");
}
if (fetch && fetch_remote(name)) {
@@ -802,12 +802,12 @@ static int mv(int argc, const char **argv, const char *prefix,
if (info->remote_name && !strcmp(info->remote_name, rename.old_name)) {
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.remote", item->string);
- git_config_set(buf.buf, rename.new_name);
+ repo_config_set(the_repository, buf.buf, rename.new_name);
}
if (info->push_remote_name && !strcmp(info->push_remote_name, rename.old_name)) {
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.pushRemote", item->string);
- git_config_set(buf.buf, rename.new_name);
+ repo_config_set(the_repository, buf.buf, rename.new_name);
}
}
@@ -1503,7 +1503,7 @@ static int set_head(int argc, const char **argv, const char *prefix,
struct strbuf config_name = STRBUF_INIT;
strbuf_addf(&config_name,
"remote.%s.followremotehead", remote->name);
- git_config_set(config_name.buf, "warn");
+ repo_config_set(the_repository, config_name.buf, "warn");
strbuf_release(&config_name);
}
@@ -1793,7 +1793,7 @@ static int set_url(int argc, const char **argv, const char *prefix,
git_config_set_multivar(name_buf.buf, newurl,
"^$", 0);
else
- git_config_set(name_buf.buf, newurl);
+ repo_config_set(the_repository, name_buf.buf, newurl);
goto out;
}
diff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c
index 3985ed108eb..43b3be01143 100644
--- a/compat/precompose_utf8.c
+++ b/compat/precompose_utf8.c
@@ -56,8 +56,8 @@ void probe_utf8_pathname_composition(void)
close(output_fd);
repo_git_path_replace(the_repository, &path, "%s", auml_nfd);
precomposed_unicode = access(path.buf, R_OK) ? 0 : 1;
- git_config_set("core.precomposeunicode",
- precomposed_unicode ? "true" : "false");
+ repo_config_set(the_repository, "core.precomposeunicode",
+ precomposed_unicode ? "true" : "false");
repo_git_path_replace(the_repository, &path, "%s", auml_nfc);
if (unlink(path.buf))
die_errno(_("failed to unlink '%s'"), path.buf);
diff --git a/config.c b/config.c
index 095a17bd429..285cab0ce2a 100644
--- a/config.c
+++ b/config.c
@@ -2748,7 +2748,7 @@ void git_die_config(struct repository *r, const char *key, const char *err, ...)
}
/*
- * Find all the stuff for git_config_set() below.
+ * Find all the stuff for repo_config_set() below.
*/
struct config_store_data {
diff --git a/config.h b/config.h
index 90977441c3b..43d06c279e3 100644
--- a/config.h
+++ b/config.h
@@ -734,11 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)
return repo_config_get_pathname(the_repository, key, dest);
}
-static inline void git_config_set(const char *key, const char *value)
-{
- repo_config_set(the_repository, key, value);
-}
-
static inline int git_config_set_in_file_gently(
const char *config_filename,
const char *key,
diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
index 948376d42d0..7420bf81fe0 100644
--- a/list-objects-filter-options.c
+++ b/list-objects-filter-options.c
@@ -350,7 +350,7 @@ void partial_clone_register(
/* Add promisor config for the remote */
cfg_name = xstrfmt("remote.%s.promisor", remote);
- git_config_set(cfg_name, "true");
+ repo_config_set(the_repository, cfg_name, "true");
free(cfg_name);
}
@@ -360,8 +360,8 @@ void partial_clone_register(
*/
filter_name = xstrfmt("remote.%s.partialclonefilter", remote);
/* NEEDSWORK: 'expand' result leaking??? */
- git_config_set(filter_name,
- expand_list_objects_filter_spec(filter_options));
+ repo_config_set(the_repository, filter_name,
+ expand_list_objects_filter_spec(filter_options));
free(filter_name);
/* Make sure the config info are reset */
diff --git a/setup.c b/setup.c
index a05c348dcdf..98ddbf377f9 100644
--- a/setup.c
+++ b/setup.c
@@ -815,7 +815,7 @@ int upgrade_repository_format(int target_version)
}
strbuf_addf(&repo_version, "%d", target_version);
- git_config_set("core.repositoryformatversion", repo_version.buf);
+ repo_config_set(the_repository, "core.repositoryformatversion", repo_version.buf);
ret = 1;
@@ -2233,14 +2233,14 @@ void initialize_repository_version(int hash_algo,
target_version = GIT_REPO_VERSION_READ;
if (hash_algo != GIT_HASH_SHA1_LEGACY && hash_algo != GIT_HASH_UNKNOWN)
- git_config_set("extensions.objectformat",
- hash_algos[hash_algo].name);
+ repo_config_set(the_repository, "extensions.objectformat",
+ hash_algos[hash_algo].name);
else if (reinit)
repo_config_set_gently(the_repository, "extensions.objectformat", NULL);
if (ref_storage_format != REF_STORAGE_FORMAT_FILES)
- git_config_set("extensions.refstorage",
- ref_storage_format_to_name(ref_storage_format));
+ repo_config_set(the_repository, "extensions.refstorage",
+ ref_storage_format_to_name(ref_storage_format));
else if (reinit)
repo_config_set_gently(the_repository, "extensions.refstorage", NULL);
@@ -2259,7 +2259,7 @@ void initialize_repository_version(int hash_algo,
}
strbuf_addf(&repo_version, "%d", target_version);
- git_config_set("core.repositoryformatversion", repo_version.buf);
+ repo_config_set(the_repository, "core.repositoryformatversion", repo_version.buf);
strbuf_release(&repo_version);
}
@@ -2375,17 +2375,17 @@ static int create_default_files(const char *template_path,
if (filemode && !reinit && (st1.st_mode & S_IXUSR))
filemode = 0;
}
- git_config_set("core.filemode", filemode ? "true" : "false");
+ repo_config_set(the_repository, "core.filemode", filemode ? "true" : "false");
if (is_bare_repository())
- git_config_set("core.bare", "true");
+ repo_config_set(the_repository, "core.bare", "true");
else {
- git_config_set("core.bare", "false");
+ repo_config_set(the_repository, "core.bare", "false");
/* allow template config file to override the default */
if (repo_settings_get_log_all_ref_updates(the_repository) == LOG_REFS_UNSET)
- git_config_set("core.logallrefupdates", "true");
+ repo_config_set(the_repository, "core.logallrefupdates", "true");
if (needs_work_tree_config(original_git_dir, work_tree))
- git_config_set("core.worktree", work_tree);
+ repo_config_set(the_repository, "core.worktree", work_tree);
}
if (!reinit) {
@@ -2398,12 +2398,12 @@ static int create_default_files(const char *template_path,
S_ISLNK(st1.st_mode))
unlink(path.buf); /* good */
else
- git_config_set("core.symlinks", "false");
+ repo_config_set(the_repository, "core.symlinks", "false");
/* Check if the filesystem is case-insensitive */
repo_git_path_replace(the_repository, &path, "CoNfIg");
if (!access(path.buf, F_OK))
- git_config_set("core.ignorecase", "true");
+ repo_config_set(the_repository, "core.ignorecase", "true");
probe_utf8_pathname_composition();
}
@@ -2639,8 +2639,8 @@ int init_db(const char *git_dir, const char *real_git_dir,
xsnprintf(buf, sizeof(buf), "%d", OLD_PERM_EVERYBODY);
else
BUG("invalid value for shared_repository");
- git_config_set("core.sharedrepository", buf);
- git_config_set("receive.denyNonFastforwards", "true");
+ repo_config_set(the_repository, "core.sharedrepository", buf);
+ repo_config_set(the_repository, "receive.denyNonFastforwards", "true");
}
if (!(flags & INIT_DB_QUIET)) {
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 15/21] config: drop `git_config_set_in_file_gently()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (13 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 14/21] config: drop `git_config_set()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 16/21] config: drop `git_config_set_multivar_in_file_gently()` wrapper Patrick Steinhardt
` (5 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove
`git_config_set_in_file_gently()`. All callsites are adjusted so that
they use `repo_config_set_in_file_gently(the_repository, ...)` instead.
While some callsites might already have a repository available, this
mechanical conversion is the exact same as the current situation and
thus cannot cause any regression. Those sites should eventually be
cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/config.c | 14 +++++++-------
builtin/submodule--helper.c | 2 +-
builtin/worktree.c | 4 ++--
config.h | 10 ----------
sequencer.c | 28 ++++++++++++++--------------
submodule-config.c | 2 +-
submodule.c | 2 +-
worktree.c | 4 ++--
8 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/builtin/config.c b/builtin/config.c
index af5d79eadc0..f7e718c6702 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -970,8 +970,8 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix,
argv[0], value, value_pattern,
comment, flags);
} else {
- ret = git_config_set_in_file_gently(location_opts.source.file,
- argv[0], comment, value);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], comment, value);
if (ret == CONFIG_NOTHING_SET)
error(_("cannot overwrite multiple values with a single value\n"
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
@@ -1014,8 +1014,8 @@ static int cmd_config_unset(int argc, const char **argv, const char *prefix,
argv[0], NULL, value_pattern,
NULL, flags);
else
- ret = git_config_set_in_file_gently(location_opts.source.file, argv[0],
- NULL, NULL);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0],
+ NULL, NULL);
location_options_release(&location_opts);
return ret;
@@ -1296,7 +1296,7 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
check_write(&location_opts.source);
check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
- ret = git_config_set_in_file_gently(location_opts.source.file, argv[0], comment, value);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0], comment, value);
if (ret == CONFIG_NOTHING_SET)
error(_("cannot overwrite multiple values with a single value\n"
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
@@ -1354,8 +1354,8 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
argv[0], NULL, argv[1],
NULL, flags);
else
- ret = git_config_set_in_file_gently(location_opts.source.file,
- argv[0], NULL, NULL);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], NULL, NULL);
}
else if (actions == ACTION_UNSET_ALL) {
check_write(&location_opts.source);
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 710a2a2004e..28f34f7bc18 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1280,7 +1280,7 @@ static void sync_submodule(const char *path, const char *prefix,
submodule_to_gitdir(the_repository, &sb, path);
strbuf_addstr(&sb, "/config");
- if (git_config_set_in_file_gently(sb.buf, remote_key, NULL, sub_origin_url))
+ if (repo_config_set_in_file_gently(the_repository, sb.buf, remote_key, NULL, sub_origin_url))
die(_("failed to update remote for submodule '%s'"),
path);
diff --git a/builtin/worktree.c b/builtin/worktree.c
index b1306248dec..fd517c82c44 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -384,8 +384,8 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)
error(_("failed to unset '%s' in '%s'"),
"core.bare", to_file);
if (!git_configset_get(&cs, "core.worktree") &&
- git_config_set_in_file_gently(to_file,
- "core.worktree", NULL, NULL))
+ repo_config_set_in_file_gently(the_repository, to_file,
+ "core.worktree", NULL, NULL))
error(_("failed to unset '%s' in '%s'"),
"core.worktree", to_file);
diff --git a/config.h b/config.h
index 43d06c279e3..4e658e47f0a 100644
--- a/config.h
+++ b/config.h
@@ -734,16 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)
return repo_config_get_pathname(the_repository, key, dest);
}
-static inline int git_config_set_in_file_gently(
- const char *config_filename,
- const char *key,
- const char *comment,
- const char *value)
-{
- return repo_config_set_in_file_gently(the_repository, config_filename,
- key, comment, value);
-}
-
static inline int git_config_set_multivar_in_file_gently(
const char *config_filename,
const char *key, const char *value,
diff --git a/sequencer.c b/sequencer.c
index f8d9bb69df8..8acb699f4f2 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3650,57 +3650,57 @@ static int save_opts(struct replay_opts *opts)
int res = 0;
if (opts->no_commit)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.no-commit", NULL, "true");
if (opts->edit >= 0)
- res |= git_config_set_in_file_gently(opts_file, "options.edit", NULL,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file, "options.edit", NULL,
opts->edit ? "true" : "false");
if (opts->allow_empty)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.allow-empty", NULL, "true");
if (opts->allow_empty_message)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.allow-empty-message", NULL, "true");
if (opts->drop_redundant_commits)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.drop-redundant-commits", NULL, "true");
if (opts->keep_redundant_commits)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.keep-redundant-commits", NULL, "true");
if (opts->signoff)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.signoff", NULL, "true");
if (opts->record_origin)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.record-origin", NULL, "true");
if (opts->allow_ff)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.allow-ff", NULL, "true");
if (opts->mainline) {
struct strbuf buf = STRBUF_INIT;
strbuf_addf(&buf, "%d", opts->mainline);
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.mainline", NULL, buf.buf);
strbuf_release(&buf);
}
if (opts->strategy)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.strategy", NULL, opts->strategy);
if (opts->gpg_sign)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.gpg-sign", NULL, opts->gpg_sign);
for (size_t i = 0; i < opts->xopts.nr; i++)
res |= git_config_set_multivar_in_file_gently(opts_file,
"options.strategy-option",
opts->xopts.v[i], "^$", NULL, 0);
if (opts->allow_rerere_auto)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.allow-rerere-auto", NULL,
opts->allow_rerere_auto == RERERE_AUTOUPDATE ?
"true" : "false");
if (opts->explicit_cleanup)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.default-msg-cleanup", NULL,
describe_cleanup_mode(opts->default_msg_cleanup));
return res;
diff --git a/submodule-config.c b/submodule-config.c
index 70324da3830..1f19fe20774 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -983,7 +983,7 @@ int config_set_in_gitmodules_file_gently(const char *key, const char *value)
{
int ret;
- ret = git_config_set_in_file_gently(GITMODULES_FILE, key, NULL, value);
+ ret = repo_config_set_in_file_gently(the_repository, GITMODULES_FILE, key, NULL, value);
if (ret < 0)
/* Maybe the user already did that, don't error out here */
warning(_("Could not update .gitmodules entry %s"), key);
diff --git a/submodule.c b/submodule.c
index f8373a9ea7d..fff3c755703 100644
--- a/submodule.c
+++ b/submodule.c
@@ -2058,7 +2058,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, NULL))
+ if (repo_config_set_in_file_gently(the_repository, config_path.buf, "core.worktree", NULL, NULL))
warning(_("Could not unset core.worktree setting in submodule '%s'"),
sub->path);
diff --git a/worktree.c b/worktree.c
index 981a2713374..a2a5f51f29f 100644
--- a/worktree.c
+++ b/worktree.c
@@ -991,9 +991,9 @@ int should_prune_worktree(const char *id, struct strbuf *reason, char **wtpath,
static int move_config_setting(const char *key, const char *value,
const char *from_file, const char *to_file)
{
- if (git_config_set_in_file_gently(to_file, key, NULL, value))
+ if (repo_config_set_in_file_gently(the_repository, to_file, key, NULL, value))
return error(_("unable to set %s in '%s'"), key, to_file);
- if (git_config_set_in_file_gently(from_file, key, NULL, NULL))
+ if (repo_config_set_in_file_gently(the_repository, from_file, key, NULL, NULL))
return error(_("unable to unset %s in '%s'"), key, from_file);
return 0;
}
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 16/21] config: drop `git_config_set_multivar_in_file_gently()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (14 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 15/21] config: drop `git_config_set_in_file_gently()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 17/21] config: drop `git_config_get_multivar_gently()` wrapper Patrick Steinhardt
` (4 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove
`git_config_set_multivar_in_file_gently()`. All callsites are adjusted
so that they use
`repo_config_set_multivar_in_file_gently(the_repository, ...)` instead.
While some callsites might already have a repository available, this
mechanical conversion is the exact same as the current situation and
thus cannot cause any regression. Those sites should eventually be
cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/config.c | 44 ++++++++++++++++++++++----------------------
builtin/gc.c | 4 ++--
builtin/worktree.c | 2 +-
config.h | 12 ------------
sequencer.c | 2 +-
5 files changed, 26 insertions(+), 38 deletions(-)
diff --git a/builtin/config.c b/builtin/config.c
index f7e718c6702..59fb113b073 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -966,9 +966,9 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix,
value = normalize_value(argv[0], argv[1], type, &default_kvi);
if ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern) {
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], value, value_pattern,
- comment, flags);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], value, value_pattern,
+ comment, flags);
} else {
ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
argv[0], comment, value);
@@ -1010,9 +1010,9 @@ static int cmd_config_unset(int argc, const char **argv, const char *prefix,
check_write(&location_opts.source);
if ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern)
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], NULL, value_pattern,
- NULL, flags);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], NULL, value_pattern,
+ NULL, flags);
else
ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0],
NULL, NULL);
@@ -1305,26 +1305,26 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
check_write(&location_opts.source);
check_argc(argc, 2, 3);
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], value, argv[2],
- comment, flags);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], value, argv[2],
+ comment, flags);
}
else if (actions == ACTION_ADD) {
check_write(&location_opts.source);
check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], value,
- CONFIG_REGEX_NONE,
- comment, flags);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], value,
+ CONFIG_REGEX_NONE,
+ comment, flags);
}
else if (actions == ACTION_REPLACE_ALL) {
check_write(&location_opts.source);
check_argc(argc, 2, 3);
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], value, argv[2],
- comment, flags | CONFIG_FLAGS_MULTI_REPLACE);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], value, argv[2],
+ comment, flags | CONFIG_FLAGS_MULTI_REPLACE);
}
else if (actions == ACTION_GET) {
check_argc(argc, 1, 2);
@@ -1350,9 +1350,9 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
check_write(&location_opts.source);
check_argc(argc, 1, 2);
if (argc == 2)
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], NULL, argv[1],
- NULL, flags);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], NULL, argv[1],
+ NULL, flags);
else
ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
argv[0], NULL, NULL);
@@ -1360,9 +1360,9 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
else if (actions == ACTION_UNSET_ALL) {
check_write(&location_opts.source);
check_argc(argc, 1, 2);
- ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
- argv[0], NULL, argv[1],
- NULL, flags | CONFIG_FLAGS_MULTI_REPLACE);
+ ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], NULL, argv[1],
+ NULL, flags | CONFIG_FLAGS_MULTI_REPLACE);
}
else if (actions == ACTION_RENAME_SECTION) {
check_write(&location_opts.source);
diff --git a/builtin/gc.c b/builtin/gc.c
index c0fe4e73087..183798f0dc9 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1938,7 +1938,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
}
if (!config_file)
die(_("$HOME not set"));
- rc = git_config_set_multivar_in_file_gently(
+ rc = repo_config_set_multivar_in_file_gently(the_repository,
config_file, "maintenance.repo", maintpath,
CONFIG_REGEX_NONE, NULL, 0);
free(global_config_file);
@@ -2007,7 +2007,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
}
if (!config_file)
die(_("$HOME not set"));
- rc = git_config_set_multivar_in_file_gently(
+ rc = repo_config_set_multivar_in_file_gently(the_repository,
config_file, key, NULL, maintpath, NULL,
CONFIG_FLAGS_MULTI_REPLACE | CONFIG_FLAGS_FIXED_VALUE);
free(global_config_file);
diff --git a/builtin/worktree.c b/builtin/worktree.c
index fd517c82c44..812774a5ca9 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -379,7 +379,7 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)
if (!git_configset_get_bool(&cs, "core.bare", &bare) &&
bare &&
- git_config_set_multivar_in_file_gently(
+ repo_config_set_multivar_in_file_gently(the_repository,
to_file, "core.bare", NULL, "true", NULL, 0))
error(_("failed to unset '%s' in '%s'"),
"core.bare", to_file);
diff --git a/config.h b/config.h
index 4e658e47f0a..e69592ada15 100644
--- a/config.h
+++ b/config.h
@@ -734,18 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)
return repo_config_get_pathname(the_repository, key, dest);
}
-static inline int git_config_set_multivar_in_file_gently(
- const char *config_filename,
- const char *key, const char *value,
- const char *value_pattern,
- const char *comment,
- unsigned flags)
-{
- return repo_config_set_multivar_in_file_gently(the_repository, config_filename,
- key, value, value_pattern,
- comment, flags);
-}
-
static inline void git_config_set_multivar_in_file(
const char *config_filename,
const char *key,
diff --git a/sequencer.c b/sequencer.c
index 8acb699f4f2..aaf2e4df64e 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3690,7 +3690,7 @@ static int save_opts(struct replay_opts *opts)
res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.gpg-sign", NULL, opts->gpg_sign);
for (size_t i = 0; i < opts->xopts.nr; i++)
- res |= git_config_set_multivar_in_file_gently(opts_file,
+ res |= repo_config_set_multivar_in_file_gently(the_repository, opts_file,
"options.strategy-option",
opts->xopts.v[i], "^$", NULL, 0);
if (opts->allow_rerere_auto)
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 17/21] config: drop `git_config_get_multivar_gently()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (15 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 16/21] config: drop `git_config_set_multivar_in_file_gently()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 18/21] config: drop `git_config_set_multivar()` wrapper Patrick Steinhardt
` (3 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove
`git_config_get_multivar_gently()`. All callsites are adjusted so that
they use `repo_config_get_multivar_gently(the_repository, ...)` instead.
While some callsites might already have a repository available, this
mechanical conversion is the exact same as the current situation and
thus cannot cause any regression. Those sites should eventually be
cleaned up in a later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
branch.c | 2 +-
builtin/clone.c | 8 ++++----
builtin/remote.c | 4 ++--
config.h | 7 -------
scalar.c | 6 +++---
5 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/branch.c b/branch.c
index 3dc237adf6c..26be3583471 100644
--- a/branch.c
+++ b/branch.c
@@ -130,7 +130,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
if (repo_config_set_gently(the_repository, key.buf, NULL) < 0)
goto out_err;
for_each_string_list_item(item, remotes)
- if (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
+ if (repo_config_set_multivar_gently(the_repository, key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
goto out_err;
if (rebasing) {
diff --git a/builtin/clone.c b/builtin/clone.c
index f025a8f19e0..183297787cb 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -762,16 +762,16 @@ static int write_one_config(const char *key, const char *value,
{
/*
* give git_clone_config a chance to write config values back to the
- * environment, since git_config_set_multivar_gently only deals with
+ * environment, since repo_config_set_multivar_gently only deals with
* config-file writes
*/
int apply_failed = git_clone_config(key, value, ctx, data);
if (apply_failed)
return apply_failed;
- return git_config_set_multivar_gently(key,
- value ? value : "true",
- CONFIG_REGEX_NONE, 0);
+ return repo_config_set_multivar_gently(the_repository, key,
+ value ? value : "true",
+ CONFIG_REGEX_NONE, 0);
}
static void write_config(struct string_list *config)
diff --git a/builtin/remote.c b/builtin/remote.c
index 827639e0398..dd340a33259 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1633,8 +1633,8 @@ static int update(int argc, const char **argv, const char *prefix,
static int remove_all_fetch_refspecs(const char *key)
{
- return git_config_set_multivar_gently(key, NULL, NULL,
- CONFIG_FLAGS_MULTI_REPLACE);
+ return repo_config_set_multivar_gently(the_repository, key, NULL, NULL,
+ CONFIG_FLAGS_MULTI_REPLACE);
}
static void add_branches(struct remote *remote, const char **branches,
diff --git a/config.h b/config.h
index e69592ada15..a90b814292c 100644
--- a/config.h
+++ b/config.h
@@ -745,13 +745,6 @@ static inline void git_config_set_multivar_in_file(
key, value, value_pattern, flags);
}
-static inline int git_config_set_multivar_gently(const char *key, const char *value,
- const char *value_pattern, unsigned flags)
-{
- return repo_config_set_multivar_gently(the_repository, key, value,
- value_pattern, flags);
-}
-
static inline void git_config_set_multivar(const char *key, const char *value,
const char *value_pattern, unsigned flags)
{
diff --git a/scalar.c b/scalar.c
index c09c5ca194e..4a373c133d8 100644
--- a/scalar.c
+++ b/scalar.c
@@ -196,9 +196,9 @@ static int set_recommended_config(int reconfigure)
if (repo_config_get_string(the_repository, "log.excludeDecoration", &value)) {
trace2_data_string("scalar", the_repository,
"log.excludeDecoration", "created");
- if (git_config_set_multivar_gently("log.excludeDecoration",
- "refs/prefetch/*",
- CONFIG_REGEX_NONE, 0))
+ if (repo_config_set_multivar_gently(the_repository, "log.excludeDecoration",
+ "refs/prefetch/*",
+ CONFIG_REGEX_NONE, 0))
return error(_("could not configure "
"log.excludeDecoration"));
} else {
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 18/21] config: drop `git_config_set_multivar()` wrapper
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (16 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 17/21] config: drop `git_config_get_multivar_gently()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 19/21] config: remove unused `the_repository` wrappers Patrick Steinhardt
` (2 subsequent siblings)
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_set_multivar()`.
All callsites are adjusted so that they use
`repo_config_set_multivar(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/branch.c | 4 ++--
builtin/clone.c | 2 +-
builtin/remote.c | 20 ++++++++++----------
config.h | 7 -------
4 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index 5de0691d18d..fa5ced452e5 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -987,10 +987,10 @@ int cmd_branch(int argc,
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.remote", branch->name);
- git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
+ repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.merge", branch->name);
- git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
+ repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
strbuf_release(&buf);
} else if (!noncreate_actions && argc > 0 && argc <= 2) {
const char *branch_name = argv[0];
diff --git a/builtin/clone.c b/builtin/clone.c
index 183297787cb..c990f398ef6 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -822,7 +822,7 @@ static void write_refspec_config(const char *src_ref_prefix,
/* Configure the remote */
if (value.len) {
strbuf_addf(&key, "remote.%s.fetch", remote_name);
- git_config_set_multivar(key.buf, value.buf, "^$", 0);
+ repo_config_set_multivar(the_repository, key.buf, value.buf, "^$", 0);
strbuf_reset(&key);
if (option_mirror) {
diff --git a/builtin/remote.c b/builtin/remote.c
index dd340a33259..4c63a8bb576 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -132,7 +132,7 @@ static void add_branch(const char *key, const char *branchname,
else
strbuf_addf(tmp, "refs/heads/%s:refs/remotes/%s/%s",
branchname, remotename, branchname);
- git_config_set_multivar(key, tmp->buf, "^$", 0);
+ repo_config_set_multivar(the_repository, key, tmp->buf, "^$", 0);
}
static const char mirror_advice[] =
@@ -634,15 +634,15 @@ static int migrate_file(struct remote *remote)
strbuf_addf(&buf, "remote.%s.url", remote->name);
for (i = 0; i < remote->url.nr; i++)
- git_config_set_multivar(buf.buf, remote->url.v[i], "^$", 0);
+ repo_config_set_multivar(the_repository, buf.buf, remote->url.v[i], "^$", 0);
strbuf_reset(&buf);
strbuf_addf(&buf, "remote.%s.push", remote->name);
for (i = 0; i < remote->push.nr; i++)
- git_config_set_multivar(buf.buf, remote->push.items[i].raw, "^$", 0);
+ repo_config_set_multivar(the_repository, buf.buf, remote->push.items[i].raw, "^$", 0);
strbuf_reset(&buf);
strbuf_addf(&buf, "remote.%s.fetch", remote->name);
for (i = 0; i < remote->fetch.nr; i++)
- git_config_set_multivar(buf.buf, remote->fetch.items[i].raw, "^$", 0);
+ repo_config_set_multivar(the_repository, buf.buf, remote->fetch.items[i].raw, "^$", 0);
#ifndef WITH_BREAKING_CHANGES
if (remote->origin == REMOTE_REMOTES)
unlink_or_warn(repo_git_path_replace(the_repository, &buf,
@@ -771,7 +771,7 @@ static int mv(int argc, const char **argv, const char *prefix,
if (oldremote->fetch.nr) {
strbuf_reset(&buf);
strbuf_addf(&buf, "remote.%s.fetch", rename.new_name);
- git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
+ repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old_name);
for (i = 0; i < oldremote->fetch.nr; i++) {
char *ptr;
@@ -791,7 +791,7 @@ static int mv(int argc, const char **argv, const char *prefix,
"\tPlease update the configuration manually if necessary."),
buf2.buf);
- git_config_set_multivar(buf.buf, buf2.buf, "^$", 0);
+ repo_config_set_multivar(the_repository, buf.buf, buf2.buf, "^$", 0);
}
}
@@ -1790,7 +1790,7 @@ static int set_url(int argc, const char **argv, const char *prefix,
/* Special cases that add new entry. */
if ((!oldurl && !delete_mode) || add_mode) {
if (add_mode)
- git_config_set_multivar(name_buf.buf, newurl,
+ repo_config_set_multivar(the_repository, name_buf.buf, newurl,
"^$", 0);
else
repo_config_set(the_repository, name_buf.buf, newurl);
@@ -1814,10 +1814,10 @@ static int set_url(int argc, const char **argv, const char *prefix,
regfree(&old_regex);
if (!delete_mode)
- git_config_set_multivar(name_buf.buf, newurl, oldurl, 0);
+ repo_config_set_multivar(the_repository, name_buf.buf, newurl, oldurl, 0);
else
- git_config_set_multivar(name_buf.buf, NULL, oldurl,
- CONFIG_FLAGS_MULTI_REPLACE);
+ repo_config_set_multivar(the_repository, name_buf.buf, NULL, oldurl,
+ CONFIG_FLAGS_MULTI_REPLACE);
out:
strbuf_release(&name_buf);
return 0;
diff --git a/config.h b/config.h
index a90b814292c..61774f17db3 100644
--- a/config.h
+++ b/config.h
@@ -744,13 +744,6 @@ static inline void git_config_set_multivar_in_file(
repo_config_set_multivar_in_file(the_repository, config_filename,
key, value, value_pattern, flags);
}
-
-static inline void git_config_set_multivar(const char *key, const char *value,
- const char *value_pattern, unsigned flags)
-{
- repo_config_set_multivar(the_repository, key, value,
- value_pattern, flags);
-}
# endif /* USE_THE_REPOSITORY_VARIABLE */
#endif /* CONFIG_H */
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 19/21] config: remove unused `the_repository` wrappers
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (17 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 18/21] config: drop `git_config_set_multivar()` wrapper Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 20/21] config: move Git config parsing into "environment.c" Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 21/21] config: fix sign comparison warnings Patrick Steinhardt
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
Remove the last couple of wrapper functions that implicitly depend on
`the_repository`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
config.h | 28 ----------------------------
1 file changed, 28 deletions(-)
diff --git a/config.h b/config.h
index 61774f17db3..87baf8eeffe 100644
--- a/config.h
+++ b/config.h
@@ -718,32 +718,4 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
lookup_config(mapping, ARRAY_SIZE(mapping), var)
int lookup_config(const char **mapping, int nr_mapping, const char *var);
-# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest)
-{
- return repo_config_get_bool_or_int(the_repository, key, is_bool, dest);
-}
-
-static inline int git_config_get_maybe_bool(const char *key, int *dest)
-{
- return repo_config_get_maybe_bool(the_repository, key, dest);
-}
-
-static inline int git_config_get_pathname(const char *key, char **dest)
-{
- return repo_config_get_pathname(the_repository, key, dest);
-}
-
-static inline void git_config_set_multivar_in_file(
- const char *config_filename,
- const char *key,
- const char *value,
- const char *value_pattern,
- unsigned flags)
-{
- repo_config_set_multivar_in_file(the_repository, config_filename,
- key, value, value_pattern, flags);
-}
-# endif /* USE_THE_REPOSITORY_VARIABLE */
-
#endif /* CONFIG_H */
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 20/21] config: move Git config parsing into "environment.c"
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (18 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 19/21] config: remove unused `the_repository` wrappers Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 21/21] config: fix sign comparison warnings Patrick Steinhardt
20 siblings, 0 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
In "config.c" we host both the business logic to read and write config
files as well as the logic to parse specific Git-related variables. On
the one hand this is mixing concerns, but even more importantly it means
that we cannot easily remove the dependency on `the_repository` in our
config parsing logic.
Move the logic into "environment.c". This file is a grab bag of all
kinds of global state already, so it is quite a good fit. Furthermore,
it also hosts most of the global variables that we're parsing the config
values into, making this an even better fit.
Note that there is one hidden change: in `parse_fsync_components()` we
use an `int` to iterate through `ARRAY_SIZE(fsync_component_names)`. But
as -Wsign-compare warnings are enabled in this file this causes a
compiler warning. The issue is fixed by using a `size_t` instead.
This change allows us to drop the `USE_THE_REPOSITORY_VARIABLE`
declaration.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/add.c | 1 +
builtin/check-ignore.c | 1 +
builtin/check-mailmap.c | 1 +
builtin/checkout--worker.c | 1 +
builtin/checkout-index.c | 1 +
builtin/clean.c | 1 +
builtin/commit-graph.c | 1 +
builtin/commit-tree.c | 1 +
builtin/count-objects.c | 1 +
builtin/credential.c | 1 +
builtin/fast-export.c | 1 +
builtin/for-each-ref.c | 1 +
builtin/fsmonitor--daemon.c | 1 +
builtin/grep.c | 1 +
builtin/hash-object.c | 1 +
builtin/help.c | 1 +
builtin/hook.c | 1 +
builtin/interpret-trailers.c | 1 +
builtin/ls-files.c | 1 +
builtin/ls-tree.c | 1 +
builtin/merge-base.c | 1 +
builtin/merge-tree.c | 1 +
builtin/multi-pack-index.c | 1 +
builtin/pack-refs.c | 1 +
builtin/patch-id.c | 1 +
builtin/pull.c | 1 +
builtin/read-tree.c | 1 +
builtin/replace.c | 1 +
builtin/rm.c | 1 +
builtin/send-pack.c | 1 +
builtin/show-ref.c | 1 +
builtin/symbolic-ref.c | 1 +
builtin/unpack-file.c | 1 +
builtin/update-ref.c | 1 +
builtin/update-server-info.c | 1 +
builtin/var.c | 1 +
builtin/verify-commit.c | 1 +
builtin/verify-pack.c | 1 +
builtin/verify-tag.c | 1 +
builtin/write-tree.c | 1 +
commit-graph.c | 1 +
config.c | 511 ------------------------------------------
config.h | 3 -
environment.c | 512 +++++++++++++++++++++++++++++++++++++++++++
environment.h | 3 +
fsck.c | 1 +
http-fetch.c | 1 +
http.c | 1 +
imap-send.c | 1 +
mailinfo.c | 1 +
reflog.c | 1 +
rerere.c | 1 +
t/helper/test-advise.c | 1 +
t/helper/test-read-cache.c | 1 +
xdiff-interface.c | 1 +
55 files changed, 566 insertions(+), 514 deletions(-)
diff --git a/builtin/add.c b/builtin/add.c
index 7c292ffdc6c..88d1d330fa8 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -7,6 +7,7 @@
#include "builtin.h"
#include "advice.h"
#include "config.h"
+#include "environment.h"
#include "lockfile.h"
#include "editor.h"
#include "dir.h"
diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c
index 03033499cb0..644c9a414ff 100644
--- a/builtin/check-ignore.c
+++ b/builtin/check-ignore.c
@@ -2,6 +2,7 @@
#include "builtin.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
#include "gettext.h"
#include "quote.h"
#include "pathspec.h"
diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c
index 634626c6728..9cc5c598302 100644
--- a/builtin/check-mailmap.c
+++ b/builtin/check-mailmap.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "ident.h"
#include "mailmap.h"
diff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c
index 27a7d4f0409..e0772b718b2 100644
--- a/builtin/checkout--worker.c
+++ b/builtin/checkout--worker.c
@@ -4,6 +4,7 @@
#include "builtin.h"
#include "config.h"
#include "entry.h"
+#include "environment.h"
#include "gettext.h"
#include "parallel-checkout.h"
#include "parse-options.h"
diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c
index 7f74bc702fa..188128aebd9 100644
--- a/builtin/checkout-index.c
+++ b/builtin/checkout-index.c
@@ -9,6 +9,7 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "lockfile.h"
#include "quote.h"
diff --git a/builtin/clean.c b/builtin/clean.c
index 5ee147c4acc..a1977b92dc8 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -13,6 +13,7 @@
#include "abspath.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "path.h"
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index c5cc601844c..4992ac146e1 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -2,6 +2,7 @@
#include "builtin.h"
#include "commit.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "parse-options.h"
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index 2f1df28d413..5189e685a7e 100644
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
@@ -6,6 +6,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "object-name.h"
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index 433daff805a..b1148a68fa8 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -7,6 +7,7 @@
#include "builtin.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
#include "gettext.h"
#include "path.h"
#include "parse-options.h"
diff --git a/builtin/credential.c b/builtin/credential.c
index 52f172e80cb..a295c80b366 100644
--- a/builtin/credential.c
+++ b/builtin/credential.c
@@ -3,6 +3,7 @@
#include "git-compat-util.h"
#include "credential.h"
#include "builtin.h"
+#include "environment.h"
#include "config.h"
static const char usage_msg[] =
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 17027b859e0..66a3a98c938 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -9,6 +9,7 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "refs.h"
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 3d2207ec773..a8f7f8c7625 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -1,6 +1,7 @@
#include "builtin.h"
#include "commit.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "object.h"
#include "parse-options.h"
diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c
index 469c62b555b..242c594646d 100644
--- a/builtin/fsmonitor--daemon.c
+++ b/builtin/fsmonitor--daemon.c
@@ -5,6 +5,7 @@
#include "abspath.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "fsmonitor-ll.h"
diff --git a/builtin/grep.c b/builtin/grep.c
index 8fcb69dbf2c..5df65373337 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -9,6 +9,7 @@
#include "builtin.h"
#include "abspath.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "config.h"
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index c3ad1e91c96..5d900a6b8c9 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -8,6 +8,7 @@
#include "builtin.h"
#include "abspath.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "object-file.h"
diff --git a/builtin/help.c b/builtin/help.c
index d79ecd946a6..c09cbc8912d 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -6,6 +6,7 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "exec-cmd.h"
#include "gettext.h"
#include "pager.h"
diff --git a/builtin/hook.c b/builtin/hook.c
index 044c27aa95d..7afec380d2e 100644
--- a/builtin/hook.c
+++ b/builtin/hook.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hook.h"
#include "parse-options.h"
diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c
index 3141c37b853..41b0750e5af 100644
--- a/builtin/interpret-trailers.c
+++ b/builtin/interpret-trailers.c
@@ -6,6 +6,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "string-list.h"
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index ff975e7be06..c06a6f33e41 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -11,6 +11,7 @@
#include "builtin.h"
#include "config.h"
#include "convert.h"
+#include "environment.h"
#include "quote.h"
#include "dir.h"
#include "gettext.h"
diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c
index 4ba84e51967..5d55731ca35 100644
--- a/builtin/ls-tree.c
+++ b/builtin/ls-tree.c
@@ -7,6 +7,7 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "object-name.h"
diff --git a/builtin/merge-base.c b/builtin/merge-base.c
index 8fde35c1751..3f82781245b 100644
--- a/builtin/merge-base.c
+++ b/builtin/merge-base.c
@@ -2,6 +2,7 @@
#include "builtin.h"
#include "config.h"
#include "commit.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "object-name.h"
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index 99a6495fd52..203f0e6456a 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
+#include "environment.h"
#include "tree-walk.h"
#include "xdiff-interface.h"
#include "help.h"
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index 9a113f0f1f3..d3b9e98be37 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -2,6 +2,7 @@
#include "builtin.h"
#include "abspath.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "midx.h"
diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c
index e47bae1c803..5e28d0f9e80 100644
--- a/builtin/pack-refs.c
+++ b/builtin/pack-refs.c
@@ -1,5 +1,6 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "refs.h"
diff --git a/builtin/patch-id.c b/builtin/patch-id.c
index a659f00531a..d26e9d0c1ea 100644
--- a/builtin/patch-id.c
+++ b/builtin/patch-id.c
@@ -3,6 +3,7 @@
#include "builtin.h"
#include "config.h"
#include "diff.h"
+#include "environment.h"
#include "gettext.h"
#include "hash.h"
#include "hex.h"
diff --git a/builtin/pull.c b/builtin/pull.c
index 5ea51c31f58..e6d3535c3b5 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -11,6 +11,7 @@
#include "builtin.h"
#include "advice.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "merge.h"
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index 00eef756e67..34f7a59f38e 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -6,6 +6,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "lockfile.h"
diff --git a/builtin/replace.c b/builtin/replace.c
index 3fe39e9df73..19897ef927f 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -11,6 +11,7 @@
#include "builtin.h"
#include "config.h"
#include "editor.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "refs.h"
diff --git a/builtin/rm.c b/builtin/rm.c
index 8c0da7a3ce7..05d89e98c3c 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -9,6 +9,7 @@
#include "builtin.h"
#include "advice.h"
#include "config.h"
+#include "environment.h"
#include "lockfile.h"
#include "dir.h"
#include "gettext.h"
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 28b69d26b48..8b81c8a8486 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -1,5 +1,6 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "hex.h"
#include "pkt-line.h"
#include "run-command.h"
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 414e55b92d5..0b6f9edf86c 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "refs/refs-internal.h"
diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c
index 5c4623067c5..231e41e715b 100644
--- a/builtin/symbolic-ref.c
+++ b/builtin/symbolic-ref.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "refs.h"
#include "parse-options.h"
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c
index ae871adc909..87877a9fabc 100644
--- a/builtin/unpack-file.c
+++ b/builtin/unpack-file.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "hex.h"
#include "object-file.h"
#include "object-name.h"
diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index cb936643243..195437e7c65 100644
--- a/builtin/update-ref.c
+++ b/builtin/update-ref.c
@@ -3,6 +3,7 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hash.h"
#include "hex.h"
diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c
index ba702d30efd..4c12968a836 100644
--- a/builtin/update-server-info.c
+++ b/builtin/update-server-info.c
@@ -1,5 +1,6 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "server-info.h"
diff --git a/builtin/var.c b/builtin/var.c
index beeac12dccf..a2d790d4532 100644
--- a/builtin/var.c
+++ b/builtin/var.c
@@ -11,6 +11,7 @@
#include "attr.h"
#include "config.h"
#include "editor.h"
+#include "environment.h"
#include "ident.h"
#include "pager.h"
#include "refs.h"
diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c
index 5f749a30daf..62398acd721 100644
--- a/builtin/verify-commit.c
+++ b/builtin/verify-commit.c
@@ -7,6 +7,7 @@
*/
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "object-name.h"
#include "commit.h"
diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c
index d9f66f5e767..65fd6629a00 100644
--- a/builtin/verify-pack.c
+++ b/builtin/verify-pack.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "run-command.h"
#include "parse-options.h"
diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c
index ed1c40338fd..cd6bc11095d 100644
--- a/builtin/verify-tag.c
+++ b/builtin/verify-tag.c
@@ -7,6 +7,7 @@
*/
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "tag.h"
#include "object-name.h"
diff --git a/builtin/write-tree.c b/builtin/write-tree.c
index 3465c70a48a..e3bd1a40dbf 100644
--- a/builtin/write-tree.c
+++ b/builtin/write-tree.c
@@ -6,6 +6,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "tree.h"
diff --git a/commit-graph.c b/commit-graph.c
index bd7b6f5338b..e0d92b816f5 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -4,6 +4,7 @@
#include "git-compat-util.h"
#include "config.h"
#include "csum-file.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "lockfile.h"
diff --git a/config.c b/config.c
index 285cab0ce2a..947fba3d8d4 100644
--- a/config.c
+++ b/config.c
@@ -6,12 +6,10 @@
*
*/
-#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "abspath.h"
-#include "advice.h"
#include "date.h"
#include "branch.h"
#include "config.h"
@@ -20,11 +18,8 @@
#include "environment.h"
#include "gettext.h"
#include "git-zlib.h"
-#include "ident.h"
#include "repository.h"
#include "lockfile.h"
-#include "mailmap.h"
-#include "attr.h"
#include "exec-cmd.h"
#include "strbuf.h"
#include "quote.h"
@@ -32,7 +27,6 @@
#include "string-list.h"
#include "object-name.h"
#include "odb.h"
-#include "pager.h"
#include "path.h"
#include "utf8.h"
#include "color.h"
@@ -41,7 +35,6 @@
#include "strvec.h"
#include "trace2.h"
#include "wildmatch.h"
-#include "ws.h"
#include "write-or-die.h"
struct config_source {
@@ -71,9 +64,6 @@ struct config_source {
};
#define CONFIG_SOURCE_INIT { 0 }
-static int pack_compression_seen;
-static int zlib_compression_seen;
-
/*
* Config that comes from trusted scopes, namely:
* - CONFIG_SCOPE_SYSTEM (e.g. /etc/gitconfig)
@@ -1262,80 +1252,6 @@ double git_config_double(const char *name, const char *value,
return ret;
}
-static const struct fsync_component_name {
- const char *name;
- enum fsync_component component_bits;
-} fsync_component_names[] = {
- { "loose-object", FSYNC_COMPONENT_LOOSE_OBJECT },
- { "pack", FSYNC_COMPONENT_PACK },
- { "pack-metadata", FSYNC_COMPONENT_PACK_METADATA },
- { "commit-graph", FSYNC_COMPONENT_COMMIT_GRAPH },
- { "index", FSYNC_COMPONENT_INDEX },
- { "objects", FSYNC_COMPONENTS_OBJECTS },
- { "reference", FSYNC_COMPONENT_REFERENCE },
- { "derived-metadata", FSYNC_COMPONENTS_DERIVED_METADATA },
- { "committed", FSYNC_COMPONENTS_COMMITTED },
- { "added", FSYNC_COMPONENTS_ADDED },
- { "all", FSYNC_COMPONENTS_ALL },
-};
-
-static enum fsync_component parse_fsync_components(const char *var, const char *string)
-{
- enum fsync_component current = FSYNC_COMPONENTS_PLATFORM_DEFAULT;
- enum fsync_component positive = 0, negative = 0;
-
- while (string) {
- int i;
- size_t len;
- const char *ep;
- int negated = 0;
- int found = 0;
-
- string = string + strspn(string, ", \t\n\r");
- ep = strchrnul(string, ',');
- len = ep - string;
- if (!strcmp(string, "none")) {
- current = FSYNC_COMPONENT_NONE;
- goto next_name;
- }
-
- if (*string == '-') {
- negated = 1;
- string++;
- len--;
- if (!len)
- warning(_("invalid value for variable %s"), var);
- }
-
- if (!len)
- break;
-
- for (i = 0; i < ARRAY_SIZE(fsync_component_names); ++i) {
- const struct fsync_component_name *n = &fsync_component_names[i];
-
- if (strncmp(n->name, string, len))
- continue;
-
- found = 1;
- if (negated)
- negative |= n->component_bits;
- else
- positive |= n->component_bits;
- }
-
- if (!found) {
- char *component = xstrndup(string, len);
- warning(_("ignoring unknown core.fsync component '%s'"), component);
- free(component);
- }
-
-next_name:
- string = ep;
- }
-
- return (current & ~negative) | positive;
-}
-
int git_config_bool_or_int(const char *name, const char *value,
const struct key_value_info *kvi, int *is_bool)
{
@@ -1393,433 +1309,6 @@ int git_config_color(char *dest, const char *var, const char *value)
return 0;
}
-static int git_default_core_config(const char *var, const char *value,
- const struct config_context *ctx, void *cb)
-{
- /* This needs a better name */
- if (!strcmp(var, "core.filemode")) {
- trust_executable_bit = git_config_bool(var, value);
- return 0;
- }
- if (!strcmp(var, "core.trustctime")) {
- trust_ctime = git_config_bool(var, value);
- return 0;
- }
- if (!strcmp(var, "core.checkstat")) {
- if (!value)
- return config_error_nonbool(var);
- if (!strcasecmp(value, "default"))
- check_stat = 1;
- else if (!strcasecmp(value, "minimal"))
- check_stat = 0;
- else
- return error(_("invalid value for '%s': '%s'"),
- var, value);
- }
-
- if (!strcmp(var, "core.quotepath")) {
- quote_path_fully = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.symlinks")) {
- has_symlinks = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.ignorecase")) {
- ignore_case = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.attributesfile")) {
- FREE_AND_NULL(git_attributes_file);
- return git_config_pathname(&git_attributes_file, var, value);
- }
-
- if (!strcmp(var, "core.bare")) {
- is_bare_repository_cfg = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.ignorestat")) {
- assume_unchanged = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.abbrev")) {
- if (!value)
- return config_error_nonbool(var);
- if (!strcasecmp(value, "auto"))
- default_abbrev = -1;
- else if (!git_parse_maybe_bool_text(value))
- default_abbrev = GIT_MAX_HEXSZ;
- else {
- int abbrev = git_config_int(var, value, ctx->kvi);
- if (abbrev < minimum_abbrev)
- return error(_("abbrev length out of range: %d"), abbrev);
- default_abbrev = abbrev;
- }
- return 0;
- }
-
- if (!strcmp(var, "core.disambiguate"))
- return set_disambiguate_hint_config(var, value);
-
- if (!strcmp(var, "core.loosecompression")) {
- int level = git_config_int(var, value, ctx->kvi);
- if (level == -1)
- level = Z_DEFAULT_COMPRESSION;
- else if (level < 0 || level > Z_BEST_COMPRESSION)
- die(_("bad zlib compression level %d"), level);
- zlib_compression_level = level;
- zlib_compression_seen = 1;
- return 0;
- }
-
- if (!strcmp(var, "core.compression")) {
- int level = git_config_int(var, value, ctx->kvi);
- if (level == -1)
- level = Z_DEFAULT_COMPRESSION;
- else if (level < 0 || level > Z_BEST_COMPRESSION)
- die(_("bad zlib compression level %d"), level);
- if (!zlib_compression_seen)
- zlib_compression_level = level;
- if (!pack_compression_seen)
- pack_compression_level = level;
- return 0;
- }
-
- if (!strcmp(var, "core.autocrlf")) {
- if (value && !strcasecmp(value, "input")) {
- auto_crlf = AUTO_CRLF_INPUT;
- return 0;
- }
- auto_crlf = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.safecrlf")) {
- int eol_rndtrp_die;
- if (value && !strcasecmp(value, "warn")) {
- global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
- return 0;
- }
- eol_rndtrp_die = git_config_bool(var, value);
- global_conv_flags_eol = eol_rndtrp_die ?
- CONV_EOL_RNDTRP_DIE : 0;
- return 0;
- }
-
- if (!strcmp(var, "core.eol")) {
- if (value && !strcasecmp(value, "lf"))
- core_eol = EOL_LF;
- else if (value && !strcasecmp(value, "crlf"))
- core_eol = EOL_CRLF;
- else if (value && !strcasecmp(value, "native"))
- core_eol = EOL_NATIVE;
- else
- core_eol = EOL_UNSET;
- return 0;
- }
-
- if (!strcmp(var, "core.checkroundtripencoding")) {
- FREE_AND_NULL(check_roundtrip_encoding);
- return git_config_string(&check_roundtrip_encoding, var, value);
- }
-
- if (!strcmp(var, "core.editor")) {
- FREE_AND_NULL(editor_program);
- return git_config_string(&editor_program, var, value);
- }
-
- if (!strcmp(var, "core.commentchar") ||
- !strcmp(var, "core.commentstring")) {
- if (!value)
- return config_error_nonbool(var);
- else if (!strcasecmp(value, "auto"))
- auto_comment_line_char = 1;
- else if (value[0]) {
- if (strchr(value, '\n'))
- return error(_("%s cannot contain newline"), var);
- comment_line_str = value;
- FREE_AND_NULL(comment_line_str_to_free);
- auto_comment_line_char = 0;
- } else
- return error(_("%s must have at least one character"), var);
- return 0;
- }
-
- if (!strcmp(var, "core.askpass")) {
- FREE_AND_NULL(askpass_program);
- return git_config_string(&askpass_program, var, value);
- }
-
- if (!strcmp(var, "core.excludesfile")) {
- FREE_AND_NULL(excludes_file);
- return git_config_pathname(&excludes_file, var, value);
- }
-
- if (!strcmp(var, "core.whitespace")) {
- if (!value)
- return config_error_nonbool(var);
- whitespace_rule_cfg = parse_whitespace_rule(value);
- return 0;
- }
-
- if (!strcmp(var, "core.fsync")) {
- if (!value)
- return config_error_nonbool(var);
- fsync_components = parse_fsync_components(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.fsyncmethod")) {
- if (!value)
- return config_error_nonbool(var);
- if (!strcmp(value, "fsync"))
- fsync_method = FSYNC_METHOD_FSYNC;
- else if (!strcmp(value, "writeout-only"))
- fsync_method = FSYNC_METHOD_WRITEOUT_ONLY;
- else if (!strcmp(value, "batch"))
- fsync_method = FSYNC_METHOD_BATCH;
- else
- warning(_("ignoring unknown core.fsyncMethod value '%s'"), value);
-
- }
-
- if (!strcmp(var, "core.fsyncobjectfiles")) {
- if (fsync_object_files < 0)
- warning(_("core.fsyncObjectFiles is deprecated; use core.fsync instead"));
- fsync_object_files = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.createobject")) {
- if (!value)
- return config_error_nonbool(var);
- if (!strcmp(value, "rename"))
- object_creation_mode = OBJECT_CREATION_USES_RENAMES;
- else if (!strcmp(value, "link"))
- object_creation_mode = OBJECT_CREATION_USES_HARDLINKS;
- else
- die(_("invalid mode for object creation: %s"), value);
- return 0;
- }
-
- if (!strcmp(var, "core.sparsecheckout")) {
- core_apply_sparse_checkout = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.sparsecheckoutcone")) {
- core_sparse_checkout_cone = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.precomposeunicode")) {
- precomposed_unicode = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.protecthfs")) {
- protect_hfs = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.protectntfs")) {
- protect_ntfs = git_config_bool(var, value);
- return 0;
- }
-
- if (!strcmp(var, "core.maxtreedepth")) {
- max_allowed_tree_depth = git_config_int(var, value, ctx->kvi);
- return 0;
- }
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return platform_core_config(var, value, ctx, cb);
-}
-
-static int git_default_sparse_config(const char *var, const char *value)
-{
- if (!strcmp(var, "sparse.expectfilesoutsideofpatterns")) {
- sparse_expect_files_outside_of_patterns = git_config_bool(var, value);
- return 0;
- }
-
- /* Add other config variables here and to Documentation/config/sparse.adoc. */
- return 0;
-}
-
-static int git_default_i18n_config(const char *var, const char *value)
-{
- if (!strcmp(var, "i18n.commitencoding")) {
- FREE_AND_NULL(git_commit_encoding);
- return git_config_string(&git_commit_encoding, var, value);
- }
-
- if (!strcmp(var, "i18n.logoutputencoding")) {
- FREE_AND_NULL(git_log_output_encoding);
- return git_config_string(&git_log_output_encoding, var, value);
- }
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return 0;
-}
-
-static int git_default_branch_config(const char *var, const char *value)
-{
- if (!strcmp(var, "branch.autosetupmerge")) {
- if (value && !strcmp(value, "always")) {
- git_branch_track = BRANCH_TRACK_ALWAYS;
- return 0;
- } else if (value && !strcmp(value, "inherit")) {
- git_branch_track = BRANCH_TRACK_INHERIT;
- return 0;
- } else if (value && !strcmp(value, "simple")) {
- git_branch_track = BRANCH_TRACK_SIMPLE;
- return 0;
- }
- git_branch_track = git_config_bool(var, value);
- return 0;
- }
- if (!strcmp(var, "branch.autosetuprebase")) {
- if (!value)
- return config_error_nonbool(var);
- else if (!strcmp(value, "never"))
- autorebase = AUTOREBASE_NEVER;
- else if (!strcmp(value, "local"))
- autorebase = AUTOREBASE_LOCAL;
- else if (!strcmp(value, "remote"))
- autorebase = AUTOREBASE_REMOTE;
- else if (!strcmp(value, "always"))
- autorebase = AUTOREBASE_ALWAYS;
- else
- return error(_("malformed value for %s"), var);
- return 0;
- }
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return 0;
-}
-
-static int git_default_push_config(const char *var, const char *value)
-{
- if (!strcmp(var, "push.default")) {
- if (!value)
- return config_error_nonbool(var);
- else if (!strcmp(value, "nothing"))
- push_default = PUSH_DEFAULT_NOTHING;
- else if (!strcmp(value, "matching"))
- push_default = PUSH_DEFAULT_MATCHING;
- else if (!strcmp(value, "simple"))
- push_default = PUSH_DEFAULT_SIMPLE;
- else if (!strcmp(value, "upstream"))
- push_default = PUSH_DEFAULT_UPSTREAM;
- else if (!strcmp(value, "tracking")) /* deprecated */
- push_default = PUSH_DEFAULT_UPSTREAM;
- else if (!strcmp(value, "current"))
- push_default = PUSH_DEFAULT_CURRENT;
- else {
- error(_("malformed value for %s: %s"), var, value);
- return error(_("must be one of nothing, matching, simple, "
- "upstream or current"));
- }
- return 0;
- }
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return 0;
-}
-
-static int git_default_mailmap_config(const char *var, const char *value)
-{
- if (!strcmp(var, "mailmap.file")) {
- FREE_AND_NULL(git_mailmap_file);
- return git_config_pathname(&git_mailmap_file, var, value);
- }
-
- if (!strcmp(var, "mailmap.blob")) {
- FREE_AND_NULL(git_mailmap_blob);
- return git_config_string(&git_mailmap_blob, var, value);
- }
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return 0;
-}
-
-static int git_default_attr_config(const char *var, const char *value)
-{
- if (!strcmp(var, "attr.tree")) {
- FREE_AND_NULL(git_attr_tree);
- return git_config_string(&git_attr_tree, var, value);
- }
-
- /*
- * Add other attribute related config variables here and to
- * Documentation/config/attr.adoc.
- */
- return 0;
-}
-
-int git_default_config(const char *var, const char *value,
- const struct config_context *ctx, void *cb)
-{
- if (starts_with(var, "core."))
- return git_default_core_config(var, value, ctx, cb);
-
- if (starts_with(var, "user.") ||
- starts_with(var, "author.") ||
- starts_with(var, "committer."))
- return git_ident_config(var, value, ctx, cb);
-
- if (starts_with(var, "i18n."))
- return git_default_i18n_config(var, value);
-
- if (starts_with(var, "branch."))
- return git_default_branch_config(var, value);
-
- if (starts_with(var, "push."))
- return git_default_push_config(var, value);
-
- if (starts_with(var, "mailmap."))
- return git_default_mailmap_config(var, value);
-
- if (starts_with(var, "attr."))
- return git_default_attr_config(var, value);
-
- if (starts_with(var, "advice.") || starts_with(var, "color.advice"))
- return git_default_advice_config(var, value);
-
- if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) {
- pager_use_color = git_config_bool(var,value);
- return 0;
- }
-
- if (!strcmp(var, "pack.packsizelimit")) {
- pack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);
- return 0;
- }
-
- if (!strcmp(var, "pack.compression")) {
- int level = git_config_int(var, value, ctx->kvi);
- if (level == -1)
- level = Z_DEFAULT_COMPRESSION;
- else if (level < 0 || level > Z_BEST_COMPRESSION)
- die(_("bad pack compression level %d"), level);
- pack_compression_level = level;
- pack_compression_seen = 1;
- return 0;
- }
-
- if (starts_with(var, "sparse."))
- return git_default_sparse_config(var, value);
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return 0;
-}
-
/*
* All source specific fields in the union, die_on_error, name and the callbacks
* fgetc, ungetc, ftell of top need to be initialized before calling
diff --git a/config.h b/config.h
index 87baf8eeffe..65fc47966e6 100644
--- a/config.h
+++ b/config.h
@@ -165,9 +165,6 @@ struct config_context {
typedef int (*config_fn_t)(const char *, const char *,
const struct config_context *, void *);
-int git_default_config(const char *, const char *,
- const struct config_context *, void *);
-
/**
* Read a specific file in git-config format.
* This function takes the same callback and data parameters as `repo_config`.
diff --git a/environment.c b/environment.c
index 7c2480b22e5..ae1427bb9e8 100644
--- a/environment.c
+++ b/environment.c
@@ -12,22 +12,34 @@
#include "git-compat-util.h"
#include "abspath.h"
+#include "advice.h"
+#include "attr.h"
#include "branch.h"
+#include "color.h"
#include "convert.h"
#include "environment.h"
#include "gettext.h"
#include "git-zlib.h"
+#include "ident.h"
+#include "mailmap.h"
+#include "object-name.h"
#include "repository.h"
#include "config.h"
#include "refs.h"
#include "fmt-merge-msg.h"
#include "commit.h"
#include "strvec.h"
+#include "pager.h"
#include "path.h"
+#include "quote.h"
#include "chdir-notify.h"
#include "setup.h"
+#include "ws.h"
#include "write-or-die.h"
+static int pack_compression_seen;
+static int zlib_compression_seen;
+
int trust_executable_bit = 1;
int trust_ctime = 1;
int check_stat = 1;
@@ -231,3 +243,503 @@ int print_sha1_ellipsis(void)
}
return cached_result;
}
+
+static const struct fsync_component_name {
+ const char *name;
+ enum fsync_component component_bits;
+} fsync_component_names[] = {
+ { "loose-object", FSYNC_COMPONENT_LOOSE_OBJECT },
+ { "pack", FSYNC_COMPONENT_PACK },
+ { "pack-metadata", FSYNC_COMPONENT_PACK_METADATA },
+ { "commit-graph", FSYNC_COMPONENT_COMMIT_GRAPH },
+ { "index", FSYNC_COMPONENT_INDEX },
+ { "objects", FSYNC_COMPONENTS_OBJECTS },
+ { "reference", FSYNC_COMPONENT_REFERENCE },
+ { "derived-metadata", FSYNC_COMPONENTS_DERIVED_METADATA },
+ { "committed", FSYNC_COMPONENTS_COMMITTED },
+ { "added", FSYNC_COMPONENTS_ADDED },
+ { "all", FSYNC_COMPONENTS_ALL },
+};
+
+static enum fsync_component parse_fsync_components(const char *var, const char *string)
+{
+ enum fsync_component current = FSYNC_COMPONENTS_PLATFORM_DEFAULT;
+ enum fsync_component positive = 0, negative = 0;
+
+ while (string) {
+ size_t len;
+ const char *ep;
+ int negated = 0;
+ int found = 0;
+
+ string = string + strspn(string, ", \t\n\r");
+ ep = strchrnul(string, ',');
+ len = ep - string;
+ if (!strcmp(string, "none")) {
+ current = FSYNC_COMPONENT_NONE;
+ goto next_name;
+ }
+
+ if (*string == '-') {
+ negated = 1;
+ string++;
+ len--;
+ if (!len)
+ warning(_("invalid value for variable %s"), var);
+ }
+
+ if (!len)
+ break;
+
+ for (size_t i = 0; i < ARRAY_SIZE(fsync_component_names); ++i) {
+ const struct fsync_component_name *n = &fsync_component_names[i];
+
+ if (strncmp(n->name, string, len))
+ continue;
+
+ found = 1;
+ if (negated)
+ negative |= n->component_bits;
+ else
+ positive |= n->component_bits;
+ }
+
+ if (!found) {
+ char *component = xstrndup(string, len);
+ warning(_("ignoring unknown core.fsync component '%s'"), component);
+ free(component);
+ }
+
+next_name:
+ string = ep;
+ }
+
+ return (current & ~negative) | positive;
+}
+
+static int git_default_core_config(const char *var, const char *value,
+ const struct config_context *ctx, void *cb)
+{
+ /* This needs a better name */
+ if (!strcmp(var, "core.filemode")) {
+ trust_executable_bit = git_config_bool(var, value);
+ return 0;
+ }
+ if (!strcmp(var, "core.trustctime")) {
+ trust_ctime = git_config_bool(var, value);
+ return 0;
+ }
+ if (!strcmp(var, "core.checkstat")) {
+ if (!value)
+ return config_error_nonbool(var);
+ if (!strcasecmp(value, "default"))
+ check_stat = 1;
+ else if (!strcasecmp(value, "minimal"))
+ check_stat = 0;
+ else
+ return error(_("invalid value for '%s': '%s'"),
+ var, value);
+ }
+
+ if (!strcmp(var, "core.quotepath")) {
+ quote_path_fully = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.symlinks")) {
+ has_symlinks = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.ignorecase")) {
+ ignore_case = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.attributesfile")) {
+ FREE_AND_NULL(git_attributes_file);
+ return git_config_pathname(&git_attributes_file, var, value);
+ }
+
+ if (!strcmp(var, "core.bare")) {
+ is_bare_repository_cfg = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.ignorestat")) {
+ assume_unchanged = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.abbrev")) {
+ if (!value)
+ return config_error_nonbool(var);
+ if (!strcasecmp(value, "auto"))
+ default_abbrev = -1;
+ else if (!git_parse_maybe_bool_text(value))
+ default_abbrev = GIT_MAX_HEXSZ;
+ else {
+ int abbrev = git_config_int(var, value, ctx->kvi);
+ if (abbrev < minimum_abbrev)
+ return error(_("abbrev length out of range: %d"), abbrev);
+ default_abbrev = abbrev;
+ }
+ return 0;
+ }
+
+ if (!strcmp(var, "core.disambiguate"))
+ return set_disambiguate_hint_config(var, value);
+
+ if (!strcmp(var, "core.loosecompression")) {
+ int level = git_config_int(var, value, ctx->kvi);
+ if (level == -1)
+ level = Z_DEFAULT_COMPRESSION;
+ else if (level < 0 || level > Z_BEST_COMPRESSION)
+ die(_("bad zlib compression level %d"), level);
+ zlib_compression_level = level;
+ zlib_compression_seen = 1;
+ return 0;
+ }
+
+ if (!strcmp(var, "core.compression")) {
+ int level = git_config_int(var, value, ctx->kvi);
+ if (level == -1)
+ level = Z_DEFAULT_COMPRESSION;
+ else if (level < 0 || level > Z_BEST_COMPRESSION)
+ die(_("bad zlib compression level %d"), level);
+ if (!zlib_compression_seen)
+ zlib_compression_level = level;
+ if (!pack_compression_seen)
+ pack_compression_level = level;
+ return 0;
+ }
+
+ if (!strcmp(var, "core.autocrlf")) {
+ if (value && !strcasecmp(value, "input")) {
+ auto_crlf = AUTO_CRLF_INPUT;
+ return 0;
+ }
+ auto_crlf = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.safecrlf")) {
+ int eol_rndtrp_die;
+ if (value && !strcasecmp(value, "warn")) {
+ global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
+ return 0;
+ }
+ eol_rndtrp_die = git_config_bool(var, value);
+ global_conv_flags_eol = eol_rndtrp_die ?
+ CONV_EOL_RNDTRP_DIE : 0;
+ return 0;
+ }
+
+ if (!strcmp(var, "core.eol")) {
+ if (value && !strcasecmp(value, "lf"))
+ core_eol = EOL_LF;
+ else if (value && !strcasecmp(value, "crlf"))
+ core_eol = EOL_CRLF;
+ else if (value && !strcasecmp(value, "native"))
+ core_eol = EOL_NATIVE;
+ else
+ core_eol = EOL_UNSET;
+ return 0;
+ }
+
+ if (!strcmp(var, "core.checkroundtripencoding")) {
+ FREE_AND_NULL(check_roundtrip_encoding);
+ return git_config_string(&check_roundtrip_encoding, var, value);
+ }
+
+ if (!strcmp(var, "core.editor")) {
+ FREE_AND_NULL(editor_program);
+ return git_config_string(&editor_program, var, value);
+ }
+
+ if (!strcmp(var, "core.commentchar") ||
+ !strcmp(var, "core.commentstring")) {
+ if (!value)
+ return config_error_nonbool(var);
+ else if (!strcasecmp(value, "auto"))
+ auto_comment_line_char = 1;
+ else if (value[0]) {
+ if (strchr(value, '\n'))
+ return error(_("%s cannot contain newline"), var);
+ comment_line_str = value;
+ FREE_AND_NULL(comment_line_str_to_free);
+ auto_comment_line_char = 0;
+ } else
+ return error(_("%s must have at least one character"), var);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.askpass")) {
+ FREE_AND_NULL(askpass_program);
+ return git_config_string(&askpass_program, var, value);
+ }
+
+ if (!strcmp(var, "core.excludesfile")) {
+ FREE_AND_NULL(excludes_file);
+ return git_config_pathname(&excludes_file, var, value);
+ }
+
+ if (!strcmp(var, "core.whitespace")) {
+ if (!value)
+ return config_error_nonbool(var);
+ whitespace_rule_cfg = parse_whitespace_rule(value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.fsync")) {
+ if (!value)
+ return config_error_nonbool(var);
+ fsync_components = parse_fsync_components(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.fsyncmethod")) {
+ if (!value)
+ return config_error_nonbool(var);
+ if (!strcmp(value, "fsync"))
+ fsync_method = FSYNC_METHOD_FSYNC;
+ else if (!strcmp(value, "writeout-only"))
+ fsync_method = FSYNC_METHOD_WRITEOUT_ONLY;
+ else if (!strcmp(value, "batch"))
+ fsync_method = FSYNC_METHOD_BATCH;
+ else
+ warning(_("ignoring unknown core.fsyncMethod value '%s'"), value);
+
+ }
+
+ if (!strcmp(var, "core.fsyncobjectfiles")) {
+ if (fsync_object_files < 0)
+ warning(_("core.fsyncObjectFiles is deprecated; use core.fsync instead"));
+ fsync_object_files = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.createobject")) {
+ if (!value)
+ return config_error_nonbool(var);
+ if (!strcmp(value, "rename"))
+ object_creation_mode = OBJECT_CREATION_USES_RENAMES;
+ else if (!strcmp(value, "link"))
+ object_creation_mode = OBJECT_CREATION_USES_HARDLINKS;
+ else
+ die(_("invalid mode for object creation: %s"), value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.sparsecheckout")) {
+ core_apply_sparse_checkout = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.sparsecheckoutcone")) {
+ core_sparse_checkout_cone = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.precomposeunicode")) {
+ precomposed_unicode = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.protecthfs")) {
+ protect_hfs = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.protectntfs")) {
+ protect_ntfs = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.maxtreedepth")) {
+ max_allowed_tree_depth = git_config_int(var, value, ctx->kvi);
+ return 0;
+ }
+
+ /* Add other config variables here and to Documentation/config.adoc. */
+ return platform_core_config(var, value, ctx, cb);
+}
+
+static int git_default_sparse_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "sparse.expectfilesoutsideofpatterns")) {
+ sparse_expect_files_outside_of_patterns = git_config_bool(var, value);
+ return 0;
+ }
+
+ /* Add other config variables here and to Documentation/config/sparse.adoc. */
+ return 0;
+}
+
+static int git_default_i18n_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "i18n.commitencoding")) {
+ FREE_AND_NULL(git_commit_encoding);
+ return git_config_string(&git_commit_encoding, var, value);
+ }
+
+ if (!strcmp(var, "i18n.logoutputencoding")) {
+ FREE_AND_NULL(git_log_output_encoding);
+ return git_config_string(&git_log_output_encoding, var, value);
+ }
+
+ /* Add other config variables here and to Documentation/config.adoc. */
+ return 0;
+}
+
+static int git_default_branch_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "branch.autosetupmerge")) {
+ if (value && !strcmp(value, "always")) {
+ git_branch_track = BRANCH_TRACK_ALWAYS;
+ return 0;
+ } else if (value && !strcmp(value, "inherit")) {
+ git_branch_track = BRANCH_TRACK_INHERIT;
+ return 0;
+ } else if (value && !strcmp(value, "simple")) {
+ git_branch_track = BRANCH_TRACK_SIMPLE;
+ return 0;
+ }
+ git_branch_track = git_config_bool(var, value);
+ return 0;
+ }
+ if (!strcmp(var, "branch.autosetuprebase")) {
+ if (!value)
+ return config_error_nonbool(var);
+ else if (!strcmp(value, "never"))
+ autorebase = AUTOREBASE_NEVER;
+ else if (!strcmp(value, "local"))
+ autorebase = AUTOREBASE_LOCAL;
+ else if (!strcmp(value, "remote"))
+ autorebase = AUTOREBASE_REMOTE;
+ else if (!strcmp(value, "always"))
+ autorebase = AUTOREBASE_ALWAYS;
+ else
+ return error(_("malformed value for %s"), var);
+ return 0;
+ }
+
+ /* Add other config variables here and to Documentation/config.adoc. */
+ return 0;
+}
+
+static int git_default_push_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "push.default")) {
+ if (!value)
+ return config_error_nonbool(var);
+ else if (!strcmp(value, "nothing"))
+ push_default = PUSH_DEFAULT_NOTHING;
+ else if (!strcmp(value, "matching"))
+ push_default = PUSH_DEFAULT_MATCHING;
+ else if (!strcmp(value, "simple"))
+ push_default = PUSH_DEFAULT_SIMPLE;
+ else if (!strcmp(value, "upstream"))
+ push_default = PUSH_DEFAULT_UPSTREAM;
+ else if (!strcmp(value, "tracking")) /* deprecated */
+ push_default = PUSH_DEFAULT_UPSTREAM;
+ else if (!strcmp(value, "current"))
+ push_default = PUSH_DEFAULT_CURRENT;
+ else {
+ error(_("malformed value for %s: %s"), var, value);
+ return error(_("must be one of nothing, matching, simple, "
+ "upstream or current"));
+ }
+ return 0;
+ }
+
+ /* Add other config variables here and to Documentation/config.adoc. */
+ return 0;
+}
+
+static int git_default_mailmap_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "mailmap.file")) {
+ FREE_AND_NULL(git_mailmap_file);
+ return git_config_pathname(&git_mailmap_file, var, value);
+ }
+
+ if (!strcmp(var, "mailmap.blob")) {
+ FREE_AND_NULL(git_mailmap_blob);
+ return git_config_string(&git_mailmap_blob, var, value);
+ }
+
+ /* Add other config variables here and to Documentation/config.adoc. */
+ return 0;
+}
+
+static int git_default_attr_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "attr.tree")) {
+ FREE_AND_NULL(git_attr_tree);
+ return git_config_string(&git_attr_tree, var, value);
+ }
+
+ /*
+ * Add other attribute related config variables here and to
+ * Documentation/config/attr.adoc.
+ */
+ return 0;
+}
+
+int git_default_config(const char *var, const char *value,
+ const struct config_context *ctx, void *cb)
+{
+ if (starts_with(var, "core."))
+ return git_default_core_config(var, value, ctx, cb);
+
+ if (starts_with(var, "user.") ||
+ starts_with(var, "author.") ||
+ starts_with(var, "committer."))
+ return git_ident_config(var, value, ctx, cb);
+
+ if (starts_with(var, "i18n."))
+ return git_default_i18n_config(var, value);
+
+ if (starts_with(var, "branch."))
+ return git_default_branch_config(var, value);
+
+ if (starts_with(var, "push."))
+ return git_default_push_config(var, value);
+
+ if (starts_with(var, "mailmap."))
+ return git_default_mailmap_config(var, value);
+
+ if (starts_with(var, "attr."))
+ return git_default_attr_config(var, value);
+
+ if (starts_with(var, "advice.") || starts_with(var, "color.advice"))
+ return git_default_advice_config(var, value);
+
+ if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) {
+ pager_use_color = git_config_bool(var,value);
+ return 0;
+ }
+
+ if (!strcmp(var, "pack.packsizelimit")) {
+ pack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);
+ return 0;
+ }
+
+ if (!strcmp(var, "pack.compression")) {
+ int level = git_config_int(var, value, ctx->kvi);
+ if (level == -1)
+ level = Z_DEFAULT_COMPRESSION;
+ else if (level < 0 || level > Z_BEST_COMPRESSION)
+ die(_("bad pack compression level %d"), level);
+ pack_compression_level = level;
+ pack_compression_seen = 1;
+ return 0;
+ }
+
+ if (starts_with(var, "sparse."))
+ return git_default_sparse_config(var, value);
+
+ /* Add other config variables here and to Documentation/config.adoc. */
+ return 0;
+}
diff --git a/environment.h b/environment.h
index 3d806ced6e4..8cfce41015b 100644
--- a/environment.h
+++ b/environment.h
@@ -104,6 +104,9 @@ int use_optional_locks(void);
const char *get_git_namespace(void);
const char *strip_namespace(const char *namespaced_ref);
+int git_default_config(const char *, const char *,
+ const struct config_context *, void *);
+
/*
* TODO: All the below state either explicitly or implicitly relies on
* `the_repository`. We should eventually get rid of these and make the
diff --git a/fsck.c b/fsck.c
index 23965e1880f..171b424dd57 100644
--- a/fsck.c
+++ b/fsck.c
@@ -3,6 +3,7 @@
#include "git-compat-util.h"
#include "date.h"
#include "dir.h"
+#include "environment.h"
#include "hex.h"
#include "odb.h"
#include "path.h"
diff --git a/http-fetch.c b/http-fetch.c
index 17b9fe4ff8c..1922e23fcd3 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -2,6 +2,7 @@
#include "git-compat-util.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "http.h"
diff --git a/http.c b/http.c
index d94e8f63b57..33ae9429fd8 100644
--- a/http.c
+++ b/http.c
@@ -3,6 +3,7 @@
#include "git-compat-util.h"
#include "git-curl-compat.h"
+#include "environment.h"
#include "hex.h"
#include "http.h"
#include "config.h"
diff --git a/imap-send.c b/imap-send.c
index 9b26c669c01..254ec83ab78 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -28,6 +28,7 @@
#include "advice.h"
#include "config.h"
#include "credential.h"
+#include "environment.h"
#include "gettext.h"
#include "run-command.h"
#include "parse-options.h"
diff --git a/mailinfo.c b/mailinfo.c
index b4e815b2d8b..99ac596e096 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -2,6 +2,7 @@
#include "git-compat-util.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "hex-ll.h"
#include "utf8.h"
diff --git a/reflog.c b/reflog.c
index 39c205fd26e..a9740051346 100644
--- a/reflog.c
+++ b/reflog.c
@@ -3,6 +3,7 @@
#include "git-compat-util.h"
#include "config.h"
+#include "environment.h"
#include "gettext.h"
#include "parse-options.h"
#include "odb.h"
diff --git a/rerere.c b/rerere.c
index c7c3e535ce5..6ec55964e2a 100644
--- a/rerere.c
+++ b/rerere.c
@@ -5,6 +5,7 @@
#include "abspath.h"
#include "config.h"
#include "copy.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "lockfile.h"
diff --git a/t/helper/test-advise.c b/t/helper/test-advise.c
index 77c15a46cfa..81ed93a05c9 100644
--- a/t/helper/test-advise.c
+++ b/t/helper/test-advise.c
@@ -3,6 +3,7 @@
#include "test-tool.h"
#include "advice.h"
#include "config.h"
+#include "environment.h"
#include "setup.h"
int cmd__advise_if_enabled(int argc, const char **argv)
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index b2da48eda05..9ae71cefb30 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -2,6 +2,7 @@
#include "test-tool.h"
#include "config.h"
+#include "environment.h"
#include "read-cache-ll.h"
#include "repository.h"
#include "setup.h"
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 0e5d38c9600..4971f722b3e 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -2,6 +2,7 @@
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
+#include "environment.h"
#include "gettext.h"
#include "config.h"
#include "hex.h"
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH v2 21/21] config: fix sign comparison warnings
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
` (19 preceding siblings ...)
2025-07-23 14:08 ` [PATCH v2 20/21] config: move Git config parsing into "environment.c" Patrick Steinhardt
@ 2025-07-23 14:08 ` Patrick Steinhardt
2025-07-23 14:48 ` Phillip Wood
2025-07-23 15:29 ` Junio C Hamano
20 siblings, 2 replies; 48+ messages in thread
From: Patrick Steinhardt @ 2025-07-23 14:08 UTC (permalink / raw)
To: git; +Cc: Phillip Wood
There are a couple of -Wsign-compare warnings in "config.c":
- `prepare_include_condition_pattern()` is returns a signed integer,
where it either returns a negative error code or the index of the
last dir separator in a path. That index will always be a
non-negative number, but we cannot just change the return type to a
`size_t` due to it being re-used as error code. This is fixed by
splitting up concerns: the return value is only used as error code,
and the prefix is now returned via an out-pointer. This fixes a sign
comparison warning when comparing `text.len < prefix`,
- We treat `struct config_store_data::seen` as signed integer in
several places even though it's unsigned.
- There are multiple trivial sign comparison warnings where we use a
signed loop index to iterate through an unsigned number of items.
Fix all of these issues and drop the `DISABLE_SIGN_COMPARE_WARNINGS`
macro.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
config.c | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/config.c b/config.c
index 947fba3d8d4..2fe8e52ae2a 100644
--- a/config.c
+++ b/config.c
@@ -6,8 +6,6 @@
*
*/
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "abspath.h"
#include "date.h"
@@ -198,11 +196,12 @@ static void add_trailing_starstar_for_dir(struct strbuf *pat)
}
static int prepare_include_condition_pattern(const struct key_value_info *kvi,
- struct strbuf *pat)
+ struct strbuf *pat,
+ size_t *out)
{
struct strbuf path = STRBUF_INIT;
char *expanded;
- int prefix = 0;
+ size_t prefix = 0;
expanded = interpolate_path(pat->buf, 1);
if (expanded) {
@@ -229,8 +228,10 @@ static int prepare_include_condition_pattern(const struct key_value_info *kvi,
add_trailing_starstar_for_dir(pat);
+ *out = prefix;
+
strbuf_release(&path);
- return prefix;
+ return 0;
}
static int include_by_gitdir(const struct key_value_info *kvi,
@@ -239,7 +240,8 @@ static int include_by_gitdir(const struct key_value_info *kvi,
{
struct strbuf text = STRBUF_INIT;
struct strbuf pattern = STRBUF_INIT;
- int ret = 0, prefix;
+ size_t prefix;
+ int ret = 0;
const char *git_dir;
int already_tried_absolute = 0;
@@ -250,12 +252,11 @@ static int include_by_gitdir(const struct key_value_info *kvi,
strbuf_realpath(&text, git_dir, 1);
strbuf_add(&pattern, cond, cond_len);
- prefix = prepare_include_condition_pattern(kvi, &pattern);
-
-again:
- if (prefix < 0)
+ ret = prepare_include_condition_pattern(kvi, &pattern, &prefix);
+ if (ret < 0)
goto done;
+again:
if (prefix > 0) {
/*
* perform literal matching on the prefix part so that
@@ -724,7 +725,6 @@ int git_config_from_parameters(config_fn_t fn, void *data)
if (env) {
unsigned long count;
char *endp;
- int i;
count = strtoul(env, &endp, 10);
if (*endp) {
@@ -736,10 +736,10 @@ int git_config_from_parameters(config_fn_t fn, void *data)
goto out;
}
- for (i = 0; i < count; i++) {
+ for (unsigned long i = 0; i < count; i++) {
const char *key, *value;
- strbuf_addf(&envvar, "GIT_CONFIG_KEY_%d", i);
+ strbuf_addf(&envvar, "GIT_CONFIG_KEY_%lu", i);
key = getenv_safe(&to_free, envvar.buf);
if (!key) {
ret = error(_("missing config key %s"), envvar.buf);
@@ -747,7 +747,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)
}
strbuf_reset(&envvar);
- strbuf_addf(&envvar, "GIT_CONFIG_VALUE_%d", i);
+ strbuf_addf(&envvar, "GIT_CONFIG_VALUE_%lu", i);
value = getenv_safe(&to_free, envvar.buf);
if (!value) {
ret = error(_("missing config value %s"), envvar.buf);
@@ -1614,13 +1614,13 @@ int config_with_options(config_fn_t fn, void *data,
static void configset_iter(struct config_set *set, config_fn_t fn, void *data)
{
- int i, value_index;
+ int value_index;
struct string_list *values;
struct config_set_element *entry;
struct configset_list *list = &set->list;
struct config_context ctx = CONFIG_CONTEXT_INIT;
- for (i = 0; i < list->nr; i++) {
+ for (size_t i = 0; i < list->nr; i++) {
entry = list->items[i].e;
value_index = list->items[i].value_index;
values = &entry->value_list;
@@ -2470,10 +2470,11 @@ static ssize_t write_pair(int fd, const char *key, const char *value,
*/
static void maybe_remove_section(struct config_store_data *store,
size_t *begin_offset, size_t *end_offset,
- int *seen_ptr)
+ unsigned *seen_ptr)
{
size_t begin;
- int i, seen, section_seen = 0;
+ int section_seen = 0;
+ unsigned int i, seen;
/*
* First, ensure that this is the first key, and that there are no
@@ -2716,7 +2717,8 @@ int repo_config_set_multivar_in_file_gently(struct repository *r,
} else {
struct stat st;
size_t copy_begin, copy_end;
- int i, new_line = 0;
+ unsigned i;
+ int new_line = 0;
struct config_options opts;
if (!value_pattern)
--
2.50.1.552.g942d659e1b.dirty
^ permalink raw reply related [flat|nested] 48+ messages in thread
* Re: [PATCH v2 21/21] config: fix sign comparison warnings
2025-07-23 14:08 ` [PATCH v2 21/21] config: fix sign comparison warnings Patrick Steinhardt
@ 2025-07-23 14:48 ` Phillip Wood
2025-07-23 15:29 ` Junio C Hamano
1 sibling, 0 replies; 48+ messages in thread
From: Phillip Wood @ 2025-07-23 14:48 UTC (permalink / raw)
To: Patrick Steinhardt, git
On 23/07/2025 15:08, Patrick Steinhardt wrote:
> There are a couple of -Wsign-compare warnings in "config.c":
>
> - `prepare_include_condition_pattern()` is returns a signed integer,
> where it either returns a negative error code or the index of the
> last dir separator in a path. That index will always be a
> non-negative number, but we cannot just change the return type to a
> `size_t` due to it being re-used as error code. This is fixed by
> splitting up concerns: the return value is only used as error code,
> and the prefix is now returned via an out-pointer. This fixes a sign
> comparison warning when comparing `text.len < prefix`,
>
Sounds good, let's see how the caller is affected ...
> @@ -239,7 +240,8 @@ static int include_by_gitdir(const struct key_value_info *kvi,
> {
> struct strbuf text = STRBUF_INIT;
> struct strbuf pattern = STRBUF_INIT;
> - int ret = 0, prefix;
> + size_t prefix;
> + int ret = 0;
> const char *git_dir;
> int already_tried_absolute = 0;
>
> @@ -250,12 +252,11 @@ static int include_by_gitdir(const struct key_value_info *kvi,
>
> strbuf_realpath(&text, git_dir, 1);
> strbuf_add(&pattern, cond, cond_len);
> - prefix = prepare_include_condition_pattern(kvi, &pattern);
> -
> -again:
> - if (prefix < 0)
> + ret = prepare_include_condition_pattern(kvi, &pattern, &prefix);
> + if (ret < 0)
> goto done;
>
> +again:
prefix is not modified below this point so moving the label down below
the error check is safe.
This looks good, thanks
Phillip
> if (prefix > 0) {
> /*
> * perform literal matching on the prefix part so that
> @@ -724,7 +725,6 @@ int git_config_from_parameters(config_fn_t fn, void *data)
> if (env) {
> unsigned long count;
> char *endp;
> - int i;
>
> count = strtoul(env, &endp, 10);
> if (*endp) {
> @@ -736,10 +736,10 @@ int git_config_from_parameters(config_fn_t fn, void *data)
> goto out;
> }
>
> - for (i = 0; i < count; i++) {
> + for (unsigned long i = 0; i < count; i++) {
> const char *key, *value;
>
> - strbuf_addf(&envvar, "GIT_CONFIG_KEY_%d", i);
> + strbuf_addf(&envvar, "GIT_CONFIG_KEY_%lu", i);
> key = getenv_safe(&to_free, envvar.buf);
> if (!key) {
> ret = error(_("missing config key %s"), envvar.buf);
> @@ -747,7 +747,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)
> }
> strbuf_reset(&envvar);
>
> - strbuf_addf(&envvar, "GIT_CONFIG_VALUE_%d", i);
> + strbuf_addf(&envvar, "GIT_CONFIG_VALUE_%lu", i);
> value = getenv_safe(&to_free, envvar.buf);
> if (!value) {
> ret = error(_("missing config value %s"), envvar.buf);
> @@ -1614,13 +1614,13 @@ int config_with_options(config_fn_t fn, void *data,
>
> static void configset_iter(struct config_set *set, config_fn_t fn, void *data)
> {
> - int i, value_index;
> + int value_index;
> struct string_list *values;
> struct config_set_element *entry;
> struct configset_list *list = &set->list;
> struct config_context ctx = CONFIG_CONTEXT_INIT;
>
> - for (i = 0; i < list->nr; i++) {
> + for (size_t i = 0; i < list->nr; i++) {
> entry = list->items[i].e;
> value_index = list->items[i].value_index;
> values = &entry->value_list;
> @@ -2470,10 +2470,11 @@ static ssize_t write_pair(int fd, const char *key, const char *value,
> */
> static void maybe_remove_section(struct config_store_data *store,
> size_t *begin_offset, size_t *end_offset,
> - int *seen_ptr)
> + unsigned *seen_ptr)
> {
> size_t begin;
> - int i, seen, section_seen = 0;
> + int section_seen = 0;
> + unsigned int i, seen;
>
> /*
> * First, ensure that this is the first key, and that there are no
> @@ -2716,7 +2717,8 @@ int repo_config_set_multivar_in_file_gently(struct repository *r,
> } else {
> struct stat st;
> size_t copy_begin, copy_end;
> - int i, new_line = 0;
> + unsigned i;
> + int new_line = 0;
> struct config_options opts;
>
> if (!value_pattern)
>
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v2 21/21] config: fix sign comparison warnings
2025-07-23 14:08 ` [PATCH v2 21/21] config: fix sign comparison warnings Patrick Steinhardt
2025-07-23 14:48 ` Phillip Wood
@ 2025-07-23 15:29 ` Junio C Hamano
1 sibling, 0 replies; 48+ messages in thread
From: Junio C Hamano @ 2025-07-23 15:29 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git, Phillip Wood
Patrick Steinhardt <ps@pks.im> writes:
> static int prepare_include_condition_pattern(const struct key_value_info *kvi,
> - struct strbuf *pat)
> + struct strbuf *pat,
> + size_t *out)
> {
> struct strbuf path = STRBUF_INIT;
> char *expanded;
> - int prefix = 0;
> + size_t prefix = 0;
>
> expanded = interpolate_path(pat->buf, 1);
> if (expanded) {
> @@ -229,8 +228,10 @@ static int prepare_include_condition_pattern(const struct key_value_info *kvi,
>
> add_trailing_starstar_for_dir(pat);
>
> + *out = prefix;
> +
> strbuf_release(&path);
> - return prefix;
> + return 0;
> }
OK, so unlike the previous attempt, this one uses an out parameter
to return the length of the prefix it counted, so the caller should
use its return value solely for noticing an error.
The first iteration would have given the caller (size_t)-1 and the
"ah, we got a non-zero prefix, let's see if it matches the string we
have" code that follows in the caller safely jumps to the "done"
label without doing any harm, so in that sense, the breakage there
was also merely theoretical ;-), but this certainly is more correct.
> @@ -239,7 +240,8 @@ static int include_by_gitdir(const struct key_value_info *kvi,
> {
> struct strbuf text = STRBUF_INIT;
> struct strbuf pattern = STRBUF_INIT;
> - int ret = 0, prefix;
> + size_t prefix;
> + int ret = 0;
And this is how the caller adjusts to the calling convention.
> const char *git_dir;
> int already_tried_absolute = 0;
>
> @@ -250,12 +252,11 @@ static int include_by_gitdir(const struct key_value_info *kvi,
>
> strbuf_realpath(&text, git_dir, 1);
> strbuf_add(&pattern, cond, cond_len);
> - prefix = prepare_include_condition_pattern(kvi, &pattern);
> -
> -again:
> - if (prefix < 0)
> + ret = prepare_include_condition_pattern(kvi, &pattern, &prefix);
> + if (ret < 0)
> goto done;
Same. Negative return value is checked for early return upon an
error, and the value we received in prefix is used as before.
> if (env) {
> unsigned long count;
> char *endp;
> - int i;
>
> count = strtoul(env, &endp, 10);
> if (*endp) {
> @@ -736,10 +736,10 @@ int git_config_from_parameters(config_fn_t fn, void *data)
> goto out;
> }
>
> - for (i = 0; i < count; i++) {
> + for (unsigned long i = 0; i < count; i++) {
> const char *key, *value;
Variable "i" of type ul looks confusing, but it is a counter to
count up to "cout" that is a result from strtoul(), so everything is
now consistent. Good.
Not that we would seriously expect that we can export more than 2
billion environment variables sensibly, so this is all theoretical
exercise ;-)
> - strbuf_addf(&envvar, "GIT_CONFIG_KEY_%d", i);
> + strbuf_addf(&envvar, "GIT_CONFIG_KEY_%lu", i);
Good.
> @@ -2470,10 +2470,11 @@ static ssize_t write_pair(int fd, const char *key, const char *value,
> */
> static void maybe_remove_section(struct config_store_data *store,
> size_t *begin_offset, size_t *end_offset,
> - int *seen_ptr)
> + unsigned *seen_ptr)
> {
> size_t begin;
> - int i, seen, section_seen = 0;
> + int section_seen = 0;
> + unsigned int i, seen;
>
> /*
> * First, ensure that this is the first key, and that there are no
The loop in the body of this function makes references to an array
with the index (i-1), but i counts downwards and never reaches 0, so
this should be OK. The next hunk is a change that adjust the caller
to this change.
> @@ -2716,7 +2717,8 @@ int repo_config_set_multivar_in_file_gently(struct repository *r,
> } else {
> struct stat st;
> size_t copy_begin, copy_end;
> - int i, new_line = 0;
> + unsigned i;
> + int new_line = 0;
> struct config_options opts;
>
> if (!value_pattern)
Looks good. Thanks.
^ permalink raw reply [flat|nested] 48+ messages in thread
end of thread, other threads:[~2025-07-23 15:29 UTC | newest]
Thread overview: 48+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 01/21] config: drop `git_config()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 02/21] config: drop `git_config_clear()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 03/21] config: drop `git_config_get()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 04/21] config: drop `git_config_get_value()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 05/21] " Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 06/21] config: drop `git_config_get_string_multi()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 07/21] config: drop `git_config_get_string()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 08/21] " Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 09/21] config: drop `git_config_get_int()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 10/21] config: drop `git_config_get_ulong()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 11/21] config: drop `git_config_get_bool()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 12/21] config: drop `git_config_set_in_file()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 13/21] config: drop `git_config_set_gently()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 14/21] config: drop `git_config_set()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 15/21] config: drop `git_config_set_in_file_gently()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 16/21] config: drop `git_config_set_multivar_in_file_gently()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 17/21] config: drop `git_config_get_multivar_gently()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 18/21] config: drop `git_config_set_multivar()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 19/21] config: remove unused `the_repository` wrappers Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 20/21] config: move Git config parsing into "environment.c" Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 21/21] config: fix sign comparison warnings Patrick Steinhardt
2025-07-23 9:38 ` Phillip Wood
2025-07-23 13:38 ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 01/21] config: drop `git_config()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 02/21] config: drop `git_config_clear()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 03/21] config: drop `git_config_get()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 04/21] config: drop `git_config_get_value()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 05/21] " Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 06/21] config: drop `git_config_get_string_multi()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 07/21] config: drop `git_config_get_string()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 08/21] " Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 09/21] config: drop `git_config_get_int()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 10/21] config: drop `git_config_get_ulong()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 11/21] config: drop `git_config_get_bool()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 12/21] config: drop `git_config_set_in_file()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 13/21] config: drop `git_config_set_gently()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 14/21] config: drop `git_config_set()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 15/21] config: drop `git_config_set_in_file_gently()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 16/21] config: drop `git_config_set_multivar_in_file_gently()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 17/21] config: drop `git_config_get_multivar_gently()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 18/21] config: drop `git_config_set_multivar()` wrapper Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 19/21] config: remove unused `the_repository` wrappers Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 20/21] config: move Git config parsing into "environment.c" Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 21/21] config: fix sign comparison warnings Patrick Steinhardt
2025-07-23 14:48 ` Phillip Wood
2025-07-23 15:29 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).