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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committedJul 23, 2025 at 16:08 UTC9ce196e86b455fa2552812802c58f30c090c94af
118 files changed+148-153
Documentation/user-manual.adoc
+1-1
index 8d00a9e822..7696987117 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))
index 249164ea77..73b63ddc41 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)
archive-zip.c
+1-1
index df8866d5ba..dbd90d9c3d 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);
index c150131bd9..08e50bf77b 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");
index 6d08abed37..3c6d8529b6 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,
builtin/column.c
+2-2
index ce6443d5fa..87dce3c6e5 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;
index 31cfd9bd15..2f1df28d41 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);
builtin/commit.c
+2-2
index fba0dded64..fcd829e04e 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)
builtin/config.c
+1-1
index 5efe273010..af5d79eadc 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");
builtin/count-objects.c
+1-1
index f687647931..433daff805 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 */
builtin/credential.c
+1-1
index 2e11b15dde..52f172e80c 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)
index 39273d9c0f..7982dda9a3 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
builtin/hash-object.c
+1-1
index ddf281413a..c3ad1e91c9 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)
builtin/help.c
+2-2
index c257079ceb..d79ecd946a 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;
builtin/hook.c
+1-1
index 672d2e37e8..044c27aa95 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)
builtin/index-pack.c
+1-1
index 0a5c8a1ac8..53f1a7cd71 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"));
index 9464f27562..3da4ca2c8c 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; }
builtin/merge-tree.c
+1-1
index cf8b06cadc..99a6495fd5 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)
builtin/merge.c
+1-1
index 18b22c0a26..dc4cb8fb14 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;
builtin/mktag.c
+1-1
index 27e649736c..e078c97d03 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"));
index e90562a3b8..0c3daa4b81 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);
builtin/receive-pack.c
+1-1
index 7974d157eb..82d516a42c 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));
index 490da33bec..44ff1b8342 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);
index 525b231d87..1ab7db9d2c 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) {
index 299d23d76a..5c4623067c 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)
builtin/tag.c
+1-1
index 46cbf892e3..25f30e3f9b 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");
builtin/unpack-file.c
+1-1
index 4360872ae0..ae871adc90 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;
builtin/unpack-objects.c
+1-1
index a69d59eb50..26aa885da9 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);
index 6d3d1000a9..54f09fcbcd 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;
index 0c5869ac34..dd7df3d5b3 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,
index 4c3817f4ec..5134781d52 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
index 6f52dab64c..91a3affdd8 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);
t/helper/test-advise.c
+1-1
index 6967c8e25c..77c15a46cf 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
t/helper/test-config.c
+4-4
index 75e028ab2a..41ba864790 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; }
t/helper/test-read-cache.c
+1-1
index e277dde8e7..b2da48eda0 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);
t/helper/test-userdiff.c
+1-1
index 94c48ababb..aa3a9894d2 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);