{"thread":{"id":"63803","subject":"[PATCH 00/21] config: remove use of `the_repository`","startedAt":"2025-07-17T10:49:32Z","lastAt":"2025-07-23T15:29:11Z","messageCount":48,"participants":["Patrick Steinhardt","Phillip Wood","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":21},"messages":[{"id":"522183","messageId":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":null,"subject":"[PATCH 00/21] config: remove use of `the_repository`","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:20Z","receivedAt":"2025-07-17T10:49:32Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Hi,\n\nthis patch series removes uses of `the_repository` in \"config.c\". It\ndoes this via two things:\n\n  - By removing all the wrapper functions `git_config_get()` et al that\n    implicitly rely on `the_repository`.\n\n  - By moving the Git-specific config parsing (that is, the non-business\n    logic like parsing \"core.sharedRepository\") into \"environment.c\".\n\nThis series is inspired by my painful tries yesterday to start parsing\nrepo settings early in the Git process lifecycle. The changes should\nmake it easier to eventually achieve that.\n\nThe patch series is long, but almost all of the patches are trivial as\nthey simply replace code like `git_config_foo(...)` with its equivalent\n`repo_config_foo(the_repository, ...)`.\n\nThe series is based on top of 90c0775e972 (The eleventh batch,\n2025-07-16) with bc/use-sha256-by-default-in-3.0 at c79bb70a2e7 (Enable\nSHA-256 by default in breaking changes mode, 2025-07-01) merged into it\nto fix a conflict with \"next\". There are a couple of merge conflicts\nwith \"seen\", but they are trivial to solve.\n\nThanks!\n\nPatrick\n\n---\nPatrick Steinhardt (21):\n      config: drop `git_config()` wrapper\n      config: drop `git_config_clear()` wrapper\n      config: drop `git_config_get()` wrapper\n      config: drop `git_config_get_value()` wrapper\n      config: drop `git_config_get_value()` wrapper\n      config: drop `git_config_get_string_multi()` wrapper\n      config: drop `git_config_get_string()` wrapper\n      config: drop `git_config_get_string()` wrapper\n      config: drop `git_config_get_int()` wrapper\n      config: drop `git_config_get_ulong()` wrapper\n      config: drop `git_config_get_bool()` wrapper\n      config: drop `git_config_set_in_file()` wrapper\n      config: drop `git_config_set_gently()` wrapper\n      config: drop `git_config_set()` wrapper\n      config: drop `git_config_set_in_file_gently()` wrapper\n      config: drop `git_config_set_multivar_in_file_gently()` wrapper\n      config: drop `git_config_get_multivar_gently()` wrapper\n      config: drop `git_config_set_multivar()` wrapper\n      config: remove unused `the_repository` wrappers\n      config: move Git config parsing into \"environment.c\"\n      config: fix sign comparison warnings\n\n Documentation/user-manual.adoc                 |   2 +-\n apply.c                                        |   6 +-\n archive-tar.c                                  |   2 +-\n archive-zip.c                                  |   2 +-\n archive.c                                      |   4 +-\n branch.c                                       |  10 +-\n builtin/add.c                                  |   1 +\n builtin/am.c                                   |  10 +-\n builtin/blame.c                                |   2 +-\n builtin/branch.c                               |   8 +-\n builtin/cat-file.c                             |   2 +-\n builtin/check-attr.c                           |   2 +-\n builtin/check-ignore.c                         |   3 +-\n builtin/check-mailmap.c                        |   3 +-\n builtin/checkout--worker.c                     |   3 +-\n builtin/checkout-index.c                       |   1 +\n builtin/checkout.c                             |   4 +-\n builtin/clean.c                                |   3 +-\n builtin/clone.c                                |  26 +-\n builtin/column.c                               |   4 +-\n builtin/commit-graph.c                         |   5 +-\n builtin/commit-tree.c                          |   3 +-\n builtin/commit.c                               |   4 +-\n builtin/config.c                               |  60 +--\n builtin/count-objects.c                        |   3 +-\n builtin/credential-cache--daemon.c             |   2 +-\n builtin/credential-store.c                     |   2 +-\n builtin/credential.c                           |   3 +-\n builtin/describe.c                             |   2 +-\n builtin/diff-files.c                           |   2 +-\n builtin/diff-index.c                           |   2 +-\n builtin/diff-tree.c                            |   2 +-\n builtin/diff.c                                 |   2 +-\n builtin/fast-export.c                          |   3 +-\n builtin/fast-import.c                          |  12 +-\n builtin/fetch.c                                |  10 +-\n builtin/fmt-merge-msg.c                        |   2 +-\n builtin/for-each-ref.c                         |   1 +\n builtin/fsck.c                                 |   2 +-\n builtin/fsmonitor--daemon.c                    |   3 +-\n builtin/gc.c                                   |  70 ++--\n builtin/grep.c                                 |   5 +-\n builtin/hash-object.c                          |   3 +-\n builtin/help.c                                 |   5 +-\n builtin/hook.c                                 |   3 +-\n builtin/index-pack.c                           |   2 +-\n builtin/interpret-trailers.c                   |   3 +-\n builtin/log.c                                  |  24 +-\n builtin/ls-files.c                             |   1 +\n builtin/ls-tree.c                              |   3 +-\n builtin/merge-base.c                           |   3 +-\n builtin/merge-file.c                           |   2 +-\n builtin/merge-tree.c                           |   3 +-\n builtin/merge.c                                |   2 +-\n builtin/mktag.c                                |   2 +-\n builtin/multi-pack-index.c                     |   5 +-\n builtin/mv.c                                   |   2 +-\n builtin/name-rev.c                             |   2 +-\n builtin/notes.c                                |   4 +-\n builtin/pack-objects.c                         |   2 +-\n builtin/pack-refs.c                            |   1 +\n builtin/patch-id.c                             |   3 +-\n builtin/pull.c                                 |   9 +-\n builtin/push.c                                 |   2 +-\n builtin/range-diff.c                           |   2 +-\n builtin/read-tree.c                            |   3 +-\n builtin/rebase.c                               |   4 +-\n builtin/receive-pack.c                         |   2 +-\n builtin/reflog.c                               |   2 +-\n builtin/refs.c                                 |   2 +-\n builtin/remote.c                               |  56 +--\n builtin/repack.c                               |   2 +-\n builtin/replace.c                              |   3 +-\n builtin/rerere.c                               |   2 +-\n builtin/reset.c                                |   2 +-\n builtin/rev-list.c                             |   2 +-\n builtin/rev-parse.c                            |   4 +-\n builtin/rm.c                                   |   3 +-\n builtin/send-pack.c                            |   1 +\n builtin/shortlog.c                             |   2 +-\n builtin/show-branch.c                          |   2 +-\n builtin/show-ref.c                             |   3 +-\n builtin/sparse-checkout.c                      |   2 +-\n builtin/stash.c                                |   4 +-\n builtin/stripspace.c                           |   2 +-\n builtin/submodule--helper.c                    |  56 +--\n builtin/symbolic-ref.c                         |   3 +-\n builtin/tag.c                                  |   2 +-\n builtin/unpack-file.c                          |   3 +-\n builtin/unpack-objects.c                       |   2 +-\n builtin/update-index.c                         |   2 +-\n builtin/update-ref.c                           |   3 +-\n builtin/update-server-info.c                   |   1 +\n builtin/var.c                                  |   5 +-\n builtin/verify-commit.c                        |   1 +\n builtin/verify-pack.c                          |   3 +-\n builtin/verify-tag.c                           |   1 +\n builtin/worktree.c                             |   8 +-\n builtin/write-tree.c                           |   3 +-\n checkout.c                                     |   2 +-\n commit-graph.c                                 |   1 +\n compat/precompose_utf8.c                       |   6 +-\n config.c                                       | 546 +------------------------\n config.h                                       | 139 -------\n connect.c                                      |   6 +-\n contrib/coccinelle/config_fn_ctx.pending.cocci |   2 +-\n convert.c                                      |   2 +-\n daemon.c                                       |   2 +-\n dir.c                                          |   4 +-\n editor.c                                       |   2 +-\n environment.c                                  | 512 +++++++++++++++++++++++\n environment.h                                  |   3 +\n fetch-pack.c                                   |  16 +-\n fsck.c                                         |   1 +\n fsck.h                                         |   2 +-\n fsmonitor.c                                    |   2 +-\n gpg-interface.c                                |   2 +-\n help.c                                         |   6 +-\n http-backend.c                                 |   6 +-\n http-fetch.c                                   |   3 +-\n http.c                                         |   3 +-\n imap-send.c                                    |   3 +-\n list-objects-filter-options.c                  |   6 +-\n ls-refs.c                                      |   2 +-\n mailinfo.c                                     |   1 +\n merge-ll.c                                     |   2 +-\n merge-ort.c                                    |  18 +-\n notes-utils.c                                  |   2 +-\n notes.c                                        |   2 +-\n parallel-checkout.c                            |   4 +-\n pretty.c                                       |   2 +-\n promisor-remote.c                              |   8 +-\n protocol.c                                     |   2 +-\n reachable.c                                    |   2 +-\n read-cache.c                                   |   4 +-\n rebase-interactive.c                           |   2 +-\n reflog.c                                       |   1 +\n refs.c                                         |   2 +-\n refs/packed-backend.c                          |   2 +-\n refs/reftable-backend.c                        |   2 +-\n remote.c                                       |   2 +-\n rerere.c                                       |   9 +-\n revision.c                                     |   2 +-\n run-command.c                                  |   6 +-\n scalar.c                                       |  18 +-\n sequencer.c                                    |  36 +-\n setup.c                                        |  44 +-\n sideband.c                                     |   6 +-\n submodule-config.c                             |   2 +-\n submodule.c                                    |   2 +-\n t/helper/test-advise.c                         |   3 +-\n t/helper/test-config.c                         |  20 +-\n t/helper/test-read-cache.c                     |   3 +-\n t/helper/test-userdiff.c                       |   2 +-\n t/t4256/1/mailinfo.c                           |   2 +-\n t/t4256/1/mailinfo.c.orig                      |   2 +-\n trailer.c                                      |   4 +-\n transport.c                                    |  12 +-\n versioncmp.c                                   |   4 +-\n worktree.c                                     |   8 +-\n xdiff-interface.c                              |   1 +\n 161 files changed, 1009 insertions(+), 1096 deletions(-)\n\n\n---\nbase-commit: 592f97530d99d182d69c66e08279e189d006b410\nchange-id: 20250716-pks-config-wo-the-repository-21de9489f965\n\n"},{"id":"522184","messageId":"20250717-pks-config-wo-the-repository-v1-1-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 01/21] config: drop `git_config()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:21Z","receivedAt":"2025-07-17T10:49:34Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config()`. All callsites\nare adjusted so that they use `repo_config(the_repository, ...)`\ninstead. While some callsites might already have a repository available,\nthis mechanical conversion is the exact same as the current situation\nand thus cannot cause any regression. Those sites should eventually be\ncleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n Documentation/user-manual.adoc                 |  2 +-\n apply.c                                        |  2 +-\n archive-tar.c                                  |  2 +-\n archive-zip.c                                  |  2 +-\n archive.c                                      |  2 +-\n builtin/am.c                                   |  2 +-\n builtin/blame.c                                |  2 +-\n builtin/branch.c                               |  2 +-\n builtin/cat-file.c                             |  2 +-\n builtin/check-attr.c                           |  2 +-\n builtin/check-ignore.c                         |  2 +-\n builtin/check-mailmap.c                        |  2 +-\n builtin/checkout--worker.c                     |  2 +-\n builtin/checkout.c                             |  2 +-\n builtin/clean.c                                |  2 +-\n builtin/clone.c                                |  4 ++--\n builtin/column.c                               |  4 ++--\n builtin/commit-graph.c                         |  4 ++--\n builtin/commit-tree.c                          |  2 +-\n builtin/commit.c                               |  4 ++--\n builtin/config.c                               |  2 +-\n builtin/count-objects.c                        |  2 +-\n builtin/credential.c                           |  2 +-\n builtin/describe.c                             |  2 +-\n builtin/diff-files.c                           |  2 +-\n builtin/diff-index.c                           |  2 +-\n builtin/diff-tree.c                            |  2 +-\n builtin/diff.c                                 |  2 +-\n builtin/fast-export.c                          |  2 +-\n builtin/fast-import.c                          |  2 +-\n builtin/fetch.c                                |  4 ++--\n builtin/fmt-merge-msg.c                        |  2 +-\n builtin/fsck.c                                 |  2 +-\n builtin/fsmonitor--daemon.c                    |  2 +-\n builtin/gc.c                                   |  2 +-\n builtin/grep.c                                 |  2 +-\n builtin/hash-object.c                          |  2 +-\n builtin/help.c                                 |  4 ++--\n builtin/hook.c                                 |  2 +-\n builtin/index-pack.c                           |  2 +-\n builtin/interpret-trailers.c                   |  2 +-\n builtin/log.c                                  | 20 ++++++++++----------\n builtin/ls-tree.c                              |  2 +-\n builtin/merge-base.c                           |  2 +-\n builtin/merge-file.c                           |  2 +-\n builtin/merge-tree.c                           |  2 +-\n builtin/merge.c                                |  2 +-\n builtin/mktag.c                                |  2 +-\n builtin/multi-pack-index.c                     |  4 ++--\n builtin/mv.c                                   |  2 +-\n builtin/name-rev.c                             |  2 +-\n builtin/notes.c                                |  2 +-\n builtin/pack-objects.c                         |  2 +-\n builtin/patch-id.c                             |  2 +-\n builtin/pull.c                                 |  2 +-\n builtin/push.c                                 |  2 +-\n builtin/range-diff.c                           |  2 +-\n builtin/read-tree.c                            |  2 +-\n builtin/rebase.c                               |  2 +-\n builtin/receive-pack.c                         |  2 +-\n builtin/reflog.c                               |  2 +-\n builtin/refs.c                                 |  2 +-\n builtin/remote.c                               |  6 +++---\n builtin/repack.c                               |  2 +-\n builtin/replace.c                              |  2 +-\n builtin/rerere.c                               |  2 +-\n builtin/reset.c                                |  2 +-\n builtin/rev-list.c                             |  2 +-\n builtin/rev-parse.c                            |  4 ++--\n builtin/rm.c                                   |  2 +-\n builtin/shortlog.c                             |  2 +-\n builtin/show-branch.c                          |  2 +-\n builtin/show-ref.c                             |  2 +-\n builtin/sparse-checkout.c                      |  2 +-\n builtin/stash.c                                |  4 ++--\n builtin/stripspace.c                           |  2 +-\n builtin/submodule--helper.c                    |  8 ++++----\n builtin/symbolic-ref.c                         |  2 +-\n builtin/tag.c                                  |  2 +-\n builtin/unpack-file.c                          |  2 +-\n builtin/unpack-objects.c                       |  2 +-\n builtin/update-index.c                         |  2 +-\n builtin/update-ref.c                           |  2 +-\n builtin/var.c                                  |  4 ++--\n builtin/verify-pack.c                          |  2 +-\n builtin/worktree.c                             |  2 +-\n builtin/write-tree.c                           |  2 +-\n config.h                                       |  5 -----\n connect.c                                      |  2 +-\n contrib/coccinelle/config_fn_ctx.pending.cocci |  2 +-\n convert.c                                      |  2 +-\n fetch-pack.c                                   |  2 +-\n fsck.h                                         |  2 +-\n gpg-interface.c                                |  2 +-\n help.c                                         |  4 ++--\n http-fetch.c                                   |  2 +-\n http.c                                         |  2 +-\n imap-send.c                                    |  2 +-\n ls-refs.c                                      |  2 +-\n merge-ll.c                                     |  2 +-\n merge-ort.c                                    |  2 +-\n notes-utils.c                                  |  2 +-\n notes.c                                        |  2 +-\n pretty.c                                       |  2 +-\n refs/reftable-backend.c                        |  2 +-\n rerere.c                                       |  4 ++--\n revision.c                                     |  2 +-\n scalar.c                                       |  2 +-\n sequencer.c                                    |  2 +-\n setup.c                                        |  4 ++--\n t/helper/test-advise.c                         |  2 +-\n t/helper/test-config.c                         |  8 ++++----\n t/helper/test-read-cache.c                     |  2 +-\n t/helper/test-userdiff.c                       |  2 +-\n t/t4256/1/mailinfo.c                           |  2 +-\n t/t4256/1/mailinfo.c.orig                      |  2 +-\n trailer.c                                      |  4 ++--\n transport.c                                    |  2 +-\n 118 files changed, 148 insertions(+), 153 deletions(-)\n\ndiff --git a/Documentation/user-manual.adoc b/Documentation/user-manual.adoc\nindex 8d00a9e8229..76969871176 100644\n--- a/Documentation/user-manual.adoc\n+++ b/Documentation/user-manual.adoc\n@@ -4270,7 +4270,7 @@ So, look into `builtin/cat-file.c`, search for `cmd_cat_file()` and look what\n it does.\n \n ------------------------------------------------------------------\n-        git_config(git_default_config);\n+        repo_config(the_repository, git_default_config);\n         if (argc != 3)\n \t\tusage(\"git cat-file [-t|-s|-e|-p|<type>] <sha1>\");\n         if (get_sha1(argv[2], sha1))\ndiff --git a/apply.c b/apply.c\nindex a3804316fbd..d2381a157c0 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -50,7 +50,7 @@ static void git_apply_config(void)\n {\n \tgit_config_get_string(\"apply.whitespace\", &apply_default_whitespace);\n \tgit_config_get_string(\"apply.ignorewhitespace\", &apply_default_ignorewhitespace);\n-\tgit_config(git_xmerge_config, NULL);\n+\trepo_config(the_repository, git_xmerge_config, NULL);\n }\n \n static int parse_whitespace_option(struct apply_state *state, const char *option)\ndiff --git a/archive-tar.c b/archive-tar.c\nindex 249164ea77d..73b63ddc41b 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -537,7 +537,7 @@ void init_tar_archiver(void)\n \ttar_filter_config(\"tar.tgz.remote\", \"true\", NULL);\n \ttar_filter_config(\"tar.tar.gz.command\", internal_gzip_command, NULL);\n \ttar_filter_config(\"tar.tar.gz.remote\", \"true\", NULL);\n-\tgit_config(git_tar_config, NULL);\n+\trepo_config(the_repository, git_tar_config, NULL);\n \tfor (i = 0; i < nr_tar_filters; i++) {\n \t\t/* omit any filters that never had a command configured */\n \t\tif (tar_filters[i]->filter_command)\ndiff --git a/archive-zip.c b/archive-zip.c\nindex df8866d5bae..dbd90d9c3d4 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -632,7 +632,7 @@ static int write_zip_archive(const struct archiver *ar UNUSED,\n {\n \tint err;\n \n-\tgit_config(archive_zip_config, NULL);\n+\trepo_config(the_repository, archive_zip_config, NULL);\n \n \tdos_time(&args->time, &zip_date, &zip_time);\n \ndiff --git a/archive.c b/archive.c\nindex f5a9d45c8d3..2dd306a07a7 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -761,7 +761,7 @@ int write_archive(int argc, const char **argv, const char *prefix,\n \tint rc;\n \n \tgit_config_get_bool(\"uploadarchive.allowunreachable\", &remote_allow_unreachable);\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tdescribe_status.max_invocations = 1;\n \tctx.date_mode.type = DATE_NORMAL;\ndiff --git a/builtin/am.c b/builtin/am.c\nindex c9d925f7b96..a7e7cf1465a 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -2445,7 +2445,7 @@ int cmd_am(int argc,\n \n \tshow_usage_with_options_if_asked(argc, argv, usage, options);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tam_state_init(&state);\n \ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 91586e6852b..71efeb7c7e6 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -947,7 +947,7 @@ int cmd_blame(int argc,\n \tconst char *const *opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage;\n \n \tsetup_default_color_by_age();\n-\tgit_config(git_blame_config, &output_option);\n+\trepo_config(the_repository, git_blame_config, &output_option);\n \trepo_init_revisions(the_repository, &revs, NULL);\n \trevs.date_mode = blame_date_mode;\n \trevs.diffopt.flags.allow_textconv = 1;\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex c150131bd9f..08e50bf77b3 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -791,7 +791,7 @@ int cmd_branch(int argc,\n \t * Try to set sort keys from config. If config does not set any,\n \t * fall back on default (refname) sorting.\n \t */\n-\tgit_config(git_branch_config, &sorting_options);\n+\trepo_config(the_repository, git_branch_config, &sorting_options);\n \tif (!sorting_options.nr)\n \t\tstring_list_append(&sorting_options, \"refname\");\n \ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 2492a0b6f39..b9eb2bb3b92 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -1095,7 +1095,7 @@ int cmd_cat_file(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_cat_file_config, NULL);\n+\trepo_config(the_repository, git_cat_file_config, NULL);\n \n \tbatch.buffer_output = -1;\n \ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex 7cf275b8937..51ed48ce437 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -119,7 +119,7 @@ int cmd_check_attr(int argc,\n \tif (!is_bare_repository())\n \t\tsetup_work_tree();\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, check_attr_options,\n \t\t\t     check_attr_usage, PARSE_OPT_KEEP_DASHDASH);\ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex 7b7831d13a8..03033499cb0 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -159,7 +159,7 @@ int cmd_check_ignore(int argc,\n \tint num_ignored;\n \tstruct dir_struct dir = DIR_INIT;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, check_ignore_options,\n \t\t\t     check_ignore_usage, 0);\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex be2cebe1215..634626c6728 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -56,7 +56,7 @@ int cmd_check_mailmap(int argc,\n \tint i;\n \tstruct string_list mailmap = STRING_LIST_INIT_NODUP;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, check_mailmap_options,\n \t\t\t     check_mailmap_usage, 0);\n \tif (argc == 0 && !use_stdin)\ndiff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c\nindex da9345a44b8..27a7d4f0409 100644\n--- a/builtin/checkout--worker.c\n+++ b/builtin/checkout--worker.c\n@@ -132,7 +132,7 @@ int cmd_checkout__worker(int argc,\n \t\t\t\t\t checkout_worker_usage,\n \t\t\t\t\t checkout_worker_options);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, checkout_worker_options,\n \t\t\t     checkout_worker_usage, 0);\n \tif (argc > 0)\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 0a90b86a729..948ff7bdda7 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -1764,7 +1764,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,\n \topts->prefix = prefix;\n \topts->show_progress = -1;\n \n-\tgit_config(git_checkout_config, opts);\n+\trepo_config(the_repository, git_checkout_config, opts);\n \tif (the_repository->gitdir) {\n \t\tprepare_repo_settings(the_repository);\n \t\tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 053c94fc6bd..5ee147c4acc 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -949,7 +949,7 @@ int cmd_clean(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_clean_config, NULL);\n+\trepo_config(the_repository, git_clean_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, options, builtin_clean_usage,\n \t\t\t     0);\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 6d08abed37c..3c6d8529b6c 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -1001,7 +1001,7 @@ int cmd_clone(int argc,\n \n \tpacket_trace_identity(\"clone\");\n \n-\tgit_config(git_clone_config, NULL);\n+\trepo_config(the_repository, git_clone_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, builtin_clone_options,\n \t\t\t     builtin_clone_usage, 0);\n@@ -1242,7 +1242,7 @@ int cmd_clone(int argc,\n \t * re-read config after init_db and write_config to pick up any config\n \t * injected by --template and --config, respectively.\n \t */\n-\tgit_config(git_clone_config, NULL);\n+\trepo_config(the_repository, git_clone_config, NULL);\n \n \t/*\n \t * If option_reject_shallow is specified from CLI option,\ndiff --git a/builtin/column.c b/builtin/column.c\nindex ce6443d5fac..87dce3c6e53 100644\n--- a/builtin/column.c\n+++ b/builtin/column.c\n@@ -42,9 +42,9 @@ int cmd_column(int argc,\n \t/* This one is special and must be the first one */\n \tif (argc > 1 && starts_with(argv[1], \"--command=\")) {\n \t\tcommand = argv[1] + 10;\n-\t\tgit_config(column_config, (void *)command);\n+\t\trepo_config(the_repository, column_config, (void *)command);\n \t} else\n-\t\tgit_config(column_config, NULL);\n+\t\trepo_config(the_repository, column_config, NULL);\n \n \tmemset(&copts, 0, sizeof(copts));\n \tcopts.padding = 1;\ndiff --git a/builtin/commit-graph.c b/builtin/commit-graph.c\nindex 25018a0b9df..c5cc601844c 100644\n--- a/builtin/commit-graph.c\n+++ b/builtin/commit-graph.c\n@@ -265,7 +265,7 @@ static int graph_write(int argc, const char **argv, const char *prefix,\n \n \ttrace2_cmd_mode(\"write\");\n \n-\tgit_config(git_commit_graph_write_config, &opts);\n+\trepo_config(the_repository, git_commit_graph_write_config, &opts);\n \n \targc = parse_options(argc, argv, prefix,\n \t\t\t     options,\n@@ -347,7 +347,7 @@ int cmd_commit_graph(int argc,\n \t};\n \tstruct option *options = parse_options_concat(builtin_commit_graph_options, common_opts);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tdisable_replace_refs();\n \tsave_commit_buffer = 0;\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex 31cfd9bd15d..2f1df28d413 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -125,7 +125,7 @@ int cmd_commit_tree(int argc,\n \t};\n \tint ret;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tshow_usage_with_options_if_asked(argc, argv,\n \t\t\t\t\t commit_tree_usage, options);\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex fba0dded64a..fcd829e04ec 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -207,9 +207,9 @@ static void status_init_config(struct wt_status *s, config_fn_t fn)\n {\n \twt_status_prepare(the_repository, s);\n \tinit_diff_ui_defaults();\n-\tgit_config(fn, s);\n+\trepo_config(the_repository, fn, s);\n \tdetermine_whence(s);\n-\ts->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after git_config() */\n+\ts->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after repo_config() */\n }\n \n static void rollback_index_files(void)\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 5efe2730106..af5d79eadc0 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -1091,7 +1091,7 @@ static int show_editor(struct config_location_options *opts)\n \t\tdie(_(\"editing stdin is not supported\"));\n \tif (opts->source.blob)\n \t\tdie(_(\"editing blobs is not supported\"));\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \tconfig_file = opts->source.file ?\n \t\t\txstrdup(opts->source.file) :\n \t\t\trepo_git_path(the_repository, \"config\");\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex f687647931e..433daff805a 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -106,7 +106,7 @@ int cmd_count_objects(int argc,\n \t\tOPT_END(),\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, opts, count_objects_usage, 0);\n \t/* we do not take arguments other than flags for now */\ndiff --git a/builtin/credential.c b/builtin/credential.c\nindex 2e11b15dde3..52f172e80cb 100644\n--- a/builtin/credential.c\n+++ b/builtin/credential.c\n@@ -16,7 +16,7 @@ int cmd_credential(int argc,\n \tconst char *op;\n \tstruct credential c = CREDENTIAL_INIT;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tshow_usage_if_asked(argc, argv, usage_msg);\n \tif (argc != 2)\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex fbf305d7624..d7dd8139dec 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -623,7 +623,7 @@ int cmd_describe(int argc,\n \t\tOPT_END(),\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, options, describe_usage, 0);\n \tif (abbrev < 0)\n \t\tabbrev = DEFAULT_ABBREV;\ndiff --git a/builtin/diff-files.c b/builtin/diff-files.c\nindex 99b1749723b..ea91347ce23 100644\n--- a/builtin/diff-files.c\n+++ b/builtin/diff-files.c\n@@ -31,7 +31,7 @@ int cmd_diff_files(int argc,\n \n \tshow_usage_if_asked(argc, argv, diff_files_usage);\n \n-\tgit_config(git_diff_basic_config, NULL); /* no \"diff\" UI options */\n+\trepo_config(the_repository, git_diff_basic_config, NULL); /* no \"diff\" UI options */\n \n \tprepare_repo_settings(the_repository);\n \tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex 81c0bc8ed7c..522dacfc4cf 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -28,7 +28,7 @@ int cmd_diff_index(int argc,\n \n \tshow_usage_if_asked(argc, argv, diff_cache_usage);\n \n-\tgit_config(git_diff_basic_config, NULL); /* no \"diff\" UI options */\n+\trepo_config(the_repository, git_diff_basic_config, NULL); /* no \"diff\" UI options */\n \n \tprepare_repo_settings(the_repository);\n \tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex e31cc797fe1..49dd4d00ebf 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -124,7 +124,7 @@ int cmd_diff_tree(int argc,\n \n \tshow_usage_if_asked(argc, argv, diff_tree_usage);\n \n-\tgit_config(git_diff_basic_config, NULL); /* no \"diff\" UI options */\n+\trepo_config(the_repository, git_diff_basic_config, NULL); /* no \"diff\" UI options */\n \n \tprepare_repo_settings(the_repository);\n \tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex eebffe36ccf..9a89e25a982 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -486,7 +486,7 @@ int cmd_diff(int argc,\n \t\trepo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);\n \n \tinit_diff_ui_defaults();\n-\tgit_config(git_diff_ui_config, NULL);\n+\trepo_config(the_repository, git_diff_ui_config, NULL);\n \tprefix = precompose_argv_prefix(argc, argv, prefix);\n \n \trepo_init_revisions(the_repository, &rev, prefix);\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 6a3a17a8cd9..17027b859e0 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -1327,7 +1327,7 @@ int cmd_fast_export(int argc,\n \t\tusage_with_options (fast_export_usage, options);\n \n \t/* we handle encodings */\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \trepo_init_revisions(the_repository, &revs, prefix);\n \tinit_revision_sources(&revision_sources);\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex b1389c59211..607441e921b 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -3541,7 +3541,7 @@ static void git_pack_config(void)\n \telse if (!git_config_get_int(\"transfer.unpacklimit\", &limit))\n \t\tunpack_limit = limit;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n }\n \n static const char fast_import_usage[] =\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 87a0cca7994..ea447c453d1 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -1995,7 +1995,7 @@ static int add_remote_or_group(const char *name, struct string_list *list)\n \tstruct remote_group_data g;\n \tg.name = name; g.list = list;\n \n-\tgit_config(get_remote_group, &g);\n+\trepo_config(the_repository, get_remote_group, &g);\n \tif (list->nr == prev_nr) {\n \t\tstruct remote *remote = remote_get(name);\n \t\tif (!remote_is_configured(remote, 0))\n@@ -2417,7 +2417,7 @@ int cmd_fetch(int argc,\n \t\tfree(anon);\n \t}\n \n-\tgit_config(git_fetch_config, &config);\n+\trepo_config(the_repository, git_fetch_config, &config);\n \tif (the_repository->gitdir) {\n \t\tprepare_repo_settings(the_repository);\n \t\tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 3b6aac2cf7f..edb93c0b3a3 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -53,7 +53,7 @@ int cmd_fmt_merge_msg(int argc,\n \tint ret;\n \tstruct fmt_merge_msg_opts opts;\n \n-\tgit_config(fmt_merge_msg_config, NULL);\n+\trepo_config(the_repository, fmt_merge_msg_config, NULL);\n \targc = parse_options(argc, argv, prefix, options, fmt_merge_msg_usage,\n \t\t\t     0);\n \tif (argc > 0)\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex 0084cf7400b..0ec6ca06e3b 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -987,7 +987,7 @@ int cmd_fsck(int argc,\n \tif (name_objects)\n \t\tfsck_enable_object_names(&fsck_walk_options);\n \n-\tgit_config(git_fsck_config, &fsck_obj_options);\n+\trepo_config(the_repository, git_fsck_config, &fsck_obj_options);\n \tprepare_repo_settings(the_repository);\n \n \tif (check_references)\ndiff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c\nindex 0820e524f1a..469c62b555b 100644\n--- a/builtin/fsmonitor--daemon.c\n+++ b/builtin/fsmonitor--daemon.c\n@@ -1547,7 +1547,7 @@ int cmd_fsmonitor__daemon(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(fsmonitor_config, NULL);\n+\trepo_config(the_repository, fsmonitor_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, options,\n \t\t\t     builtin_fsmonitor__daemon_usage, 0);\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex fab8f4dd4f7..d9e3b9d2ec3 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -228,7 +228,7 @@ static void gc_config(struct gc_config *cfg)\n \t\tcfg->repack_filter_to = owned;\n \t}\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n }\n \n enum schedule_priority {\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 39273d9c0fd..7982dda9a3b 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -1035,7 +1035,7 @@ int cmd_grep(int argc,\n \tgrep_prefix = prefix;\n \n \tgrep_init(&opt, the_repository);\n-\tgit_config(grep_cmd_config, &opt);\n+\trepo_config(the_repository, grep_cmd_config, &opt);\n \n \t/*\n \t * If there is no -- then the paths must exist in the working\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex ddf281413a6..c3ad1e91c96 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -111,7 +111,7 @@ int cmd_hash_object(int argc,\n \t\tvpath = vpath_free;\n \t}\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tif (stdin_paths) {\n \t\tif (hashstdin)\ndiff --git a/builtin/help.c b/builtin/help.c\nindex c257079cebc..d79ecd946a6 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -210,7 +210,7 @@ static enum help_format parse_help_format(const char *format)\n \tif (!strcmp(format, \"web\") || !strcmp(format, \"html\"))\n \t\treturn HELP_FORMAT_WEB;\n \t/*\n-\t * Please update _git_config() in git-completion.bash when you\n+\t * Please update _repo_config() in git-completion.bash when you\n \t * add new help formats.\n \t */\n \tdie(_(\"unrecognized help format '%s'\"), format);\n@@ -706,7 +706,7 @@ int cmd_help(int argc,\n \t}\n \n \tsetup_git_directory_gently(&nongit);\n-\tgit_config(git_help_config, NULL);\n+\trepo_config(the_repository, git_help_config, NULL);\n \n \tif (parsed_help_format != HELP_FORMAT_NONE)\n \t\thelp_format = parsed_help_format;\ndiff --git a/builtin/hook.c b/builtin/hook.c\nindex 672d2e37e84..044c27aa95d 100644\n--- a/builtin/hook.c\n+++ b/builtin/hook.c\n@@ -55,7 +55,7 @@ static int run(int argc, const char **argv, const char *prefix,\n \t\tstrvec_push(&opt.args, argv[i]);\n \n \t/* Need to take into account core.hooksPath */\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \thook_name = argv[0];\n \tif (!ignore_missing)\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 0a5c8a1ac85..53f1a7cd71e 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -1917,7 +1917,7 @@ int cmd_index_pack(int argc,\n \n \treset_pack_idx_option(&opts);\n \topts.flags |= WRITE_REV;\n-\tgit_config(git_index_pack_config, &opts);\n+\trepo_config(the_repository, git_index_pack_config, &opts);\n \tif (prefix && chdir(prefix))\n \t\tdie(_(\"Cannot come back to cwd\"));\n \ndiff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c\nindex 44d8ccddc9d..3141c37b853 100644\n--- a/builtin/interpret-trailers.c\n+++ b/builtin/interpret-trailers.c\n@@ -220,7 +220,7 @@ int cmd_interpret_trailers(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, options,\n \t\t\t     git_interpret_trailers_usage, 0);\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 24a57c20a41..1bedc4ef355 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -659,10 +659,10 @@ int cmd_whatchanged(int argc,\n \n \tlog_config_init(&cfg);\n \tinit_diff_ui_defaults();\n-\tgit_config(git_log_config, &cfg);\n+\trepo_config(the_repository, git_log_config, &cfg);\n \n \trepo_init_revisions(the_repository, &rev, prefix);\n-\tgit_config(grep_config, &rev.grep_filter);\n+\trepo_config(the_repository, grep_config, &rev.grep_filter);\n \n \trev.diff = 1;\n \trev.simplify_history = 0;\n@@ -790,7 +790,7 @@ int cmd_show(int argc,\n \n \tlog_config_init(&cfg);\n \tinit_diff_ui_defaults();\n-\tgit_config(git_log_config, &cfg);\n+\trepo_config(the_repository, git_log_config, &cfg);\n \n \tif (the_repository->gitdir) {\n \t\tprepare_repo_settings(the_repository);\n@@ -799,7 +799,7 @@ int cmd_show(int argc,\n \n \tmemset(&match_all, 0, sizeof(match_all));\n \trepo_init_revisions(the_repository, &rev, prefix);\n-\tgit_config(grep_config, &rev.grep_filter);\n+\trepo_config(the_repository, grep_config, &rev.grep_filter);\n \n \trev.diff = 1;\n \trev.always_show_header = 1;\n@@ -907,11 +907,11 @@ int cmd_log_reflog(int argc,\n \n \tlog_config_init(&cfg);\n \tinit_diff_ui_defaults();\n-\tgit_config(git_log_config, &cfg);\n+\trepo_config(the_repository, git_log_config, &cfg);\n \n \trepo_init_revisions(the_repository, &rev, prefix);\n \tinit_reflog_walk(&rev.reflog_info);\n-\tgit_config(grep_config, &rev.grep_filter);\n+\trepo_config(the_repository, grep_config, &rev.grep_filter);\n \n \trev.verbose_header = 1;\n \tmemset(&opt, 0, sizeof(opt));\n@@ -952,10 +952,10 @@ int cmd_log(int argc,\n \n \tlog_config_init(&cfg);\n \tinit_diff_ui_defaults();\n-\tgit_config(git_log_config, &cfg);\n+\trepo_config(the_repository, git_log_config, &cfg);\n \n \trepo_init_revisions(the_repository, &rev, prefix);\n-\tgit_config(grep_config, &rev.grep_filter);\n+\trepo_config(the_repository, grep_config, &rev.grep_filter);\n \n \trev.always_show_header = 1;\n \tmemset(&opt, 0, sizeof(opt));\n@@ -2158,9 +2158,9 @@ int cmd_format_patch(int argc,\n \tformat_config_init(&cfg);\n \tinit_diff_ui_defaults();\n \tinit_display_notes(&cfg.notes_opt);\n-\tgit_config(git_format_config, &cfg);\n+\trepo_config(the_repository, git_format_config, &cfg);\n \trepo_init_revisions(the_repository, &rev, prefix);\n-\tgit_config(grep_config, &rev.grep_filter);\n+\trepo_config(the_repository, grep_config, &rev.grep_filter);\n \n \trev.show_notes = cfg.show_notes;\n \tmemcpy(&rev.notes_opt, &cfg.notes_opt, sizeof(cfg.notes_opt));\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex 4d616dd5282..4ba84e51967 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -375,7 +375,7 @@ int cmd_ls_tree(int argc,\n \tstruct object_context obj_context = {0};\n \tint ret;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, ls_tree_options,\n \t\t\t     ls_tree_usage, 0);\ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex 123c81515e1..8fde35c1751 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -167,7 +167,7 @@ int cmd_merge_base(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, options, merge_base_usage, 0);\n \n \tif (cmdmode == 'a') {\ndiff --git a/builtin/merge-file.c b/builtin/merge-file.c\nindex 9464f275629..3da4ca2c8cf 100644\n--- a/builtin/merge-file.c\n+++ b/builtin/merge-file.c\n@@ -97,7 +97,7 @@ int cmd_merge_file(int argc,\n \n \tif (startup_info->have_repository) {\n \t\t/* Read the configuration file */\n-\t\tgit_config(git_xmerge_config, NULL);\n+\t\trepo_config(the_repository, git_xmerge_config, NULL);\n \t\tif (0 <= git_xmerge_style)\n \t\t\txmp.style = git_xmerge_style;\n \t}\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex cf8b06cadc7..99a6495fd52 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -683,7 +683,7 @@ int cmd_merge_tree(int argc,\n \tif (argc != expected_remaining_argc)\n \t\tusage_with_options(merge_tree_usage, mt_options);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \t/* Do the relevant type of merge */\n \tif (o.mode == MODE_REAL)\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 18b22c0a26d..dc4cb8fb14d 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1392,7 +1392,7 @@ int cmd_merge(int argc,\n \t\tskip_prefix(branch, \"refs/heads/\", &branch);\n \n \tinit_diff_ui_defaults();\n-\tgit_config(git_merge_config, NULL);\n+\trepo_config(the_repository, git_merge_config, NULL);\n \n \tif (!branch || is_null_oid(&head_oid))\n \t\thead_commit = NULL;\ndiff --git a/builtin/mktag.c b/builtin/mktag.c\nindex 27e649736cf..e078c97d032 100644\n--- a/builtin/mktag.c\n+++ b/builtin/mktag.c\n@@ -98,7 +98,7 @@ int cmd_mktag(int argc,\n \tfsck_set_msg_type_from_ids(&fsck_options, FSCK_MSG_EXTRA_HEADER_ENTRY,\n \t\t\t\t   FSCK_WARN);\n \t/* config might set fsck.extraHeaderEntry=* again */\n-\tgit_config(git_fsck_config, &fsck_options);\n+\trepo_config(the_repository, git_fsck_config, &fsck_options);\n \tif (fsck_tag_standalone(NULL, buf.buf, buf.len, &fsck_options,\n \t\t\t\t&tagged_oid, &tagged_type))\n \t\tdie(_(\"tag on stdin did not pass our strict fsck check\"));\ndiff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c\nindex aa25b06f9d0..9a113f0f1f3 100644\n--- a/builtin/multi-pack-index.c\n+++ b/builtin/multi-pack-index.c\n@@ -143,7 +143,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,\n \n \topts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;\n \n-\tgit_config(git_multi_pack_index_write_config, NULL);\n+\trepo_config(the_repository, git_multi_pack_index_write_config, NULL);\n \n \toptions = add_common_options(builtin_multi_pack_index_write_options);\n \n@@ -290,7 +290,7 @@ int cmd_multi_pack_index(int argc,\n \n \tdisable_replace_refs();\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tif (the_repository &&\n \t    the_repository->objects &&\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex 07548fe96ae..d43925097b4 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -239,7 +239,7 @@ int cmd_mv(int argc,\n \tstruct strbuf pathbuf = STRBUF_INIT;\n \tint ret;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, builtin_mv_options,\n \t\t\t     builtin_mv_usage, 0);\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex ff199638dee..74512e54a38 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -600,7 +600,7 @@ int cmd_name_rev(int argc,\n \n \tmem_pool_init(&string_pool, 0);\n \tinit_commit_rev_name(&rev_names);\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0);\n \n #ifndef WITH_BREAKING_CHANGES\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex a9529b1696a..17004cdb10e 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -1145,7 +1145,7 @@ int cmd_notes(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, options, git_notes_usage,\n \t\t\t     PARSE_OPT_SUBCOMMAND_OPTIONAL);\n \tif (!fn) {\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 5781dec9808..8c86ec2d89f 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -4924,7 +4924,7 @@ int cmd_pack_objects(int argc,\n \n \treset_pack_idx_option(&pack_idx_opts);\n \tpack_idx_opts.flags |= WRITE_REV;\n-\tgit_config(git_pack_config, NULL);\n+\trepo_config(the_repository, git_pack_config, NULL);\n \tif (git_env_bool(GIT_TEST_NO_WRITE_REV_INDEX, 0))\n \t\tpack_idx_opts.flags &= ~WRITE_REV;\n \ndiff --git a/builtin/patch-id.c b/builtin/patch-id.c\nindex 26f04b0335d..a659f00531a 100644\n--- a/builtin/patch-id.c\n+++ b/builtin/patch-id.c\n@@ -235,7 +235,7 @@ int cmd_patch_id(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_patch_id_config, &config);\n+\trepo_config(the_repository, git_patch_id_config, &config);\n \n \t/* verbatim implies stable */\n \tif (config.verbatim)\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex c593f324fe7..d13ed9b5176 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -999,7 +999,7 @@ int cmd_pull(int argc,\n \tif (!getenv(\"GIT_REFLOG_ACTION\"))\n \t\tset_reflog_message(argc, argv);\n \n-\tgit_config(git_pull_config, NULL);\n+\trepo_config(the_repository, git_pull_config, NULL);\n \tif (the_repository->gitdir) {\n \t\tprepare_repo_settings(the_repository);\n \t\tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 92d530e5c4d..d0794b7b305 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -598,7 +598,7 @@ int cmd_push(int argc,\n \t};\n \n \tpacket_trace_identity(\"push\");\n-\tgit_config(git_push_config, &flags);\n+\trepo_config(the_repository, git_push_config, &flags);\n \targc = parse_options(argc, argv, prefix, options, push_usage, 0);\n \tpush_options = (push_options_cmdline.nr\n \t\t? &push_options_cmdline\ndiff --git a/builtin/range-diff.c b/builtin/range-diff.c\nindex 32ddb6613fb..a563abff5fe 100644\n--- a/builtin/range-diff.c\n+++ b/builtin/range-diff.c\n@@ -54,7 +54,7 @@ int cmd_range_diff(int argc,\n \tstruct object_id oid;\n \tconst char *three_dots = NULL;\n \n-\tgit_config(git_diff_ui_config, NULL);\n+\trepo_config(the_repository, git_diff_ui_config, NULL);\n \n \trepo_diff_setup(the_repository, &diffopt);\n \ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex a8f352f7cd9..00eef756e67 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -168,7 +168,7 @@ int cmd_read_tree(int argc,\n \topts.src_index = the_repository->index;\n \topts.dst_index = the_repository->index;\n \n-\tgit_config(git_read_tree_config, NULL);\n+\trepo_config(the_repository, git_read_tree_config, NULL);\n \n \targc = parse_options(argc, argv, cmd_prefix, read_tree_options,\n \t\t\t     read_tree_usage, 0);\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex e90562a3b8a..0c3daa4b814 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1245,7 +1245,7 @@ int cmd_rebase(int argc,\n \tprepare_repo_settings(the_repository);\n \tthe_repository->settings.command_requires_full_index = 0;\n \n-\tgit_config(rebase_config, &options);\n+\trepo_config(the_repository, rebase_config, &options);\n \t/* options.gpg_sign_opt will be either \"-S\" or NULL */\n \tgpg_sign = options.gpg_sign_opt ? \"\" : NULL;\n \tFREE_AND_NULL(options.gpg_sign_opt);\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 7974d157eb9..82d516a42c4 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -2613,7 +2613,7 @@ int cmd_receive_pack(int argc,\n \tif (!enter_repo(service_dir, 0))\n \t\tdie(\"'%s' does not appear to be a git repository\", service_dir);\n \n-\tgit_config(receive_pack_config, NULL);\n+\trepo_config(the_repository, receive_pack_config, NULL);\n \tif (cert_nonce_seed)\n \t\tpush_cert_nonce = prepare_push_cert_nonce(service_dir, time(NULL));\n \ndiff --git a/builtin/reflog.c b/builtin/reflog.c\nindex 3acaf3e32c2..4312f3d34c9 100644\n--- a/builtin/reflog.c\n+++ b/builtin/reflog.c\n@@ -202,7 +202,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(reflog_expire_config, &opts);\n+\trepo_config(the_repository, reflog_expire_config, &opts);\n \n \tsave_commit_buffer = 0;\n \tdo_all = status = 0;\ndiff --git a/builtin/refs.c b/builtin/refs.c\nindex 998d2a2c1cc..c7ad0a2963a 100644\n--- a/builtin/refs.c\n+++ b/builtin/refs.c\n@@ -88,7 +88,7 @@ static int cmd_refs_verify(int argc, const char **argv, const char *prefix,\n \tif (argc)\n \t\tusage(_(\"'git refs verify' takes no arguments\"));\n \n-\tgit_config(git_fsck_config, &fsck_refs_options);\n+\trepo_config(the_repository, git_fsck_config, &fsck_refs_options);\n \tprepare_repo_settings(the_repository);\n \n \tworktrees = get_worktrees_without_reading_head();\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 18843b6bf6c..ebd70bea3a1 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -353,7 +353,7 @@ static void read_branches(void)\n {\n \tif (branch_list.nr)\n \t\treturn;\n-\tgit_config(config_read_branches, NULL);\n+\trepo_config(the_repository, config_read_branches, NULL);\n }\n \n struct ref_states {\n@@ -690,7 +690,7 @@ static void handle_push_default(const char* old_name, const char* new_name)\n \t\t.origin = STRBUF_INIT,\n \t\t.linenr = -1,\n \t};\n-\tgit_config(config_read_push_default, &push_default);\n+\trepo_config(the_repository, config_read_push_default, &push_default);\n \tif (push_default.scope >= CONFIG_SCOPE_COMMAND)\n \t\t; /* pass */\n \telse if (push_default.scope >= CONFIG_SCOPE_LOCAL) {\n@@ -1620,7 +1620,7 @@ static int update(int argc, const char **argv, const char *prefix,\n \t\tstrvec_push(&cmd.args, argv[i]);\n \n \tif (strcmp(cmd.args.v[cmd.args.nr-1], \"default\") == 0) {\n-\t\tgit_config(get_remote_default, &default_defined);\n+\t\trepo_config(the_repository, get_remote_default, &default_defined);\n \t\tif (!default_defined) {\n \t\t\tstrvec_pop(&cmd.args);\n \t\t\tstrvec_push(&cmd.args, \"--all\");\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex b05ffe46239..dd1db282dac 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -1230,7 +1230,7 @@ int cmd_repack(int argc,\n \n \tlist_objects_filter_init(&po_args.filter_options);\n \n-\tgit_config(repack_config, &cruft_po_args);\n+\trepo_config(the_repository, repack_config, &cruft_po_args);\n \n \targc = parse_options(argc, argv, prefix, builtin_repack_options,\n \t\t\t\tgit_repack_usage, 0);\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 5ff2ab723cb..3fe39e9df73 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -574,7 +574,7 @@ int cmd_replace(int argc,\n \t};\n \n \tdisable_replace_refs();\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, options, git_replace_usage, 0);\n \ndiff --git a/builtin/rerere.c b/builtin/rerere.c\nindex 1312e79d89f..a056cb791b4 100644\n--- a/builtin/rerere.c\n+++ b/builtin/rerere.c\n@@ -66,7 +66,7 @@ int cmd_rerere(int argc,\n \n \targc = parse_options(argc, argv, prefix, options, rerere_usage, 0);\n \n-\tgit_config(git_xmerge_config, NULL);\n+\trepo_config(the_repository, git_xmerge_config, NULL);\n \n \tif (autoupdate == 1)\n \t\tflags = RERERE_AUTOUPDATE;\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex dc50ffc1ac5..00492c19b06 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -377,7 +377,7 @@ int cmd_reset(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_reset_config, NULL);\n+\trepo_config(the_repository, git_reset_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, options, git_reset_usage,\n \t\t\t\t\t\tPARSE_OPT_KEEP_DASHDASH);\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 4d0c460f186..034ea0a558a 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -636,7 +636,7 @@ int cmd_rev_list(int argc,\n \n \tshow_usage_if_asked(argc, argv, rev_list_usage);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \trepo_init_revisions(the_repository, &revs, prefix);\n \trevs.abbrev = DEFAULT_ABBREV;\n \trevs.commit_format = CMIT_FMT_UNSPECIFIED;\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 490da33becc..44ff1b8342a 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -734,7 +734,7 @@ int cmd_rev_parse(int argc,\n \t/* No options; just report on whether we're in a git repo or not. */\n \tif (argc == 1) {\n \t\tsetup_git_directory();\n-\t\tgit_config(git_default_config, NULL);\n+\t\trepo_config(the_repository, git_default_config, NULL);\n \t\treturn 0;\n \t}\n \n@@ -769,7 +769,7 @@ int cmd_rev_parse(int argc,\n \t\t/* The rest of the options require a git repository. */\n \t\tif (!did_repo_setup) {\n \t\t\tprefix = setup_git_directory();\n-\t\t\tgit_config(git_default_config, NULL);\n+\t\t\trepo_config(the_repository, git_default_config, NULL);\n \t\t\tdid_repo_setup = 1;\n \n \t\t\tprepare_repo_settings(the_repository);\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex a6565a69cfc..8c0da7a3ce7 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -271,7 +271,7 @@ int cmd_rm(int argc,\n \tstruct pathspec pathspec;\n \tchar *seen;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, builtin_rm_options,\n \t\t\t     builtin_rm_usage, 0);\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 60adc5e7a56..b91acf45c8f 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -421,7 +421,7 @@ int cmd_shortlog(int argc,\n \tif (nongit && !the_hash_algo)\n \t\trepo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \tshortlog_init(&log);\n \trepo_init_revisions(the_repository, &rev, prefix);\n \tparse_options_start(&ctx, argc, argv, prefix, options,\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 525b231d87e..1ab7db9d2ca 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -710,7 +710,7 @@ int cmd_show_branch(int ac,\n \n \tinit_commit_name_slab(&name_slab);\n \n-\tgit_config(git_show_branch_config, NULL);\n+\trepo_config(the_repository, git_show_branch_config, NULL);\n \n \t/* If nothing is specified, try the default first */\n \tif (ac == 1 && default_args.nr) {\ndiff --git a/builtin/show-ref.c b/builtin/show-ref.c\nindex 117709cb076..414e55b92d5 100644\n--- a/builtin/show-ref.c\n+++ b/builtin/show-ref.c\n@@ -324,7 +324,7 @@ struct repository *repo UNUSED)\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, show_ref_options,\n \t\t\t     show_ref_usage, 0);\ndiff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c\nindex 1bf01591b27..8c333b3e2e1 100644\n--- a/builtin/sparse-checkout.c\n+++ b/builtin/sparse-checkout.c\n@@ -1082,7 +1082,7 @@ int cmd_sparse_checkout(int argc,\n \t\t\t     builtin_sparse_checkout_options,\n \t\t\t     builtin_sparse_checkout_usage, 0);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tprepare_repo_settings(the_repository);\n \tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex e2f95cc2ebc..821b58a14e5 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -979,7 +979,7 @@ static int show_stash(int argc, const char **argv, const char *prefix,\n \tint do_usage = 0;\n \n \tinit_diff_ui_defaults();\n-\tgit_config(git_diff_ui_config, NULL);\n+\trepo_config(the_repository, git_diff_ui_config, NULL);\n \trepo_init_revisions(the_repository, &rev, prefix);\n \n \targc = parse_options(argc, argv, prefix, options, git_stash_show_usage,\n@@ -2358,7 +2358,7 @@ int cmd_stash(int argc,\n \tconst char **args_copy;\n \tint ret;\n \n-\tgit_config(git_stash_config, NULL);\n+\trepo_config(the_repository, git_stash_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, options, git_stash_usage,\n \t\t\t     PARSE_OPT_SUBCOMMAND_OPTIONAL |\ndiff --git a/builtin/stripspace.c b/builtin/stripspace.c\nindex e147f3ff92c..4a566cbc5de 100644\n--- a/builtin/stripspace.c\n+++ b/builtin/stripspace.c\n@@ -55,7 +55,7 @@ int cmd_stripspace(int argc,\n \n \tif (mode == STRIP_COMMENTS || mode == COMMENT_LINES) {\n \t\tsetup_git_directory_gently(&nongit);\n-\t\tgit_config(git_default_config, NULL);\n+\t\trepo_config(the_repository, git_default_config, NULL);\n \t}\n \n \tif (strbuf_read(&buf, 0, 1024) < 0)\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex d8a6fa47e59..89ee09abea6 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -649,7 +649,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,\n \t\t     \"--ignore-submodules=dirty\", \"--quiet\", \"--\",\n \t\t     path, NULL);\n \n-\tgit_config(git_diff_basic_config, NULL);\n+\trepo_config(the_repository, git_diff_basic_config, NULL);\n \n \trepo_init_revisions(the_repository, &rev, NULL);\n \trev.abbrev = 0;\n@@ -1108,7 +1108,7 @@ static int compute_summary_module_list(struct object_id *head_oid,\n \tif (info->argc)\n \t\tstrvec_pushv(&diff_args, info->argv);\n \n-\tgit_config(git_diff_basic_config, NULL);\n+\trepo_config(the_repository, git_diff_basic_config, NULL);\n \trepo_init_revisions(the_repository, &rev, info->prefix);\n \trev.abbrev = 0;\n \tprecompose_argv_prefix(diff_args.nr, diff_args.v, NULL);\n@@ -2830,7 +2830,7 @@ static int module_update(int argc, const char **argv, const char *prefix,\n \t};\n \n \tupdate_clone_config_from_gitmodules(&opt.max_jobs);\n-\tgit_config(git_update_clone_config, &opt.max_jobs);\n+\trepo_config(the_repository, git_update_clone_config, &opt.max_jobs);\n \n \targc = parse_options(argc, argv, prefix, module_update_options,\n \t\t\t     git_submodule_helper_usage, 0);\n@@ -3128,7 +3128,7 @@ static int module_create_branch(int argc, const char **argv, const char *prefix,\n \t\tNULL\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \ttrack = git_branch_track;\n \targc = parse_options(argc, argv, prefix, options, usage, 0);\n \ndiff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c\nindex 299d23d76a8..5c4623067c5 100644\n--- a/builtin/symbolic-ref.c\n+++ b/builtin/symbolic-ref.c\n@@ -59,7 +59,7 @@ int cmd_symbolic_ref(int argc,\n \t\tOPT_END(),\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, options,\n \t\t\t     git_symbolic_ref_usage, 0);\n \tif (msg && !*msg)\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 46cbf892e34..25f30e3f9be 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -546,7 +546,7 @@ int cmd_tag(int argc,\n \t * Try to set sort keys from config. If config does not set any,\n \t * fall back on default (refname) sorting.\n \t */\n-\tgit_config(git_tag_config, &sorting_options);\n+\trepo_config(the_repository, git_tag_config, &sorting_options);\n \tif (!sorting_options.nr)\n \t\tstring_list_append(&sorting_options, \"refname\");\n \ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex 4360872ae07..ae871adc909 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -43,7 +43,7 @@ int cmd_unpack_file(int argc,\n \tif (repo_get_oid(the_repository, argv[1], &oid))\n \t\tdie(\"Not a valid object name %s\", argv[1]);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tputs(create_temp_file(&oid));\n \treturn 0;\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex a69d59eb50c..26aa885da92 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -621,7 +621,7 @@ int cmd_unpack_objects(int argc,\n \n \tdisable_replace_refs();\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tquiet = !isatty(2);\n \ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex 0c1d4ed55be..2380f3ccd68 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -1103,7 +1103,7 @@ int cmd_update_index(int argc,\n \tshow_usage_with_options_if_asked(argc, argv,\n \t\t\t\t\t update_index_usage, options);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tprepare_repo_settings(r);\n \tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex 1e6131e04ad..cb936643243 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -769,7 +769,7 @@ int cmd_update_ref(int argc,\n \t\tOPT_END(),\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, options, git_update_ref_usage,\n \t\t\t     0);\n \tif (msg && !*msg)\ndiff --git a/builtin/var.c b/builtin/var.c\nindex ada642a9fe5..beeac12dccf 100644\n--- a/builtin/var.c\n+++ b/builtin/var.c\n@@ -226,11 +226,11 @@ int cmd_var(int argc,\n \t\tusage(var_usage);\n \n \tif (strcmp(argv[1], \"-l\") == 0) {\n-\t\tgit_config(show_config, NULL);\n+\t\trepo_config(the_repository, show_config, NULL);\n \t\tlist_vars();\n \t\treturn 0;\n \t}\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tgit_var = get_git_var(argv[1]);\n \tif (!git_var)\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex 34e4ed715f3..d9f66f5e767 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -81,7 +81,7 @@ int cmd_verify_pack(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, verify_pack_options,\n \t\t\t     verify_pack_usage, 0);\n \tif (argc < 1)\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 2dceeeed8bd..b1306248dec 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -1448,7 +1448,7 @@ int cmd_worktree(int ac,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_worktree_config, NULL);\n+\trepo_config(the_repository, git_worktree_config, NULL);\n \n \tif (!prefix)\n \t\tprefix = \"\";\ndiff --git a/builtin/write-tree.c b/builtin/write-tree.c\nindex cfec044710a..3465c70a48a 100644\n--- a/builtin/write-tree.c\n+++ b/builtin/write-tree.c\n@@ -43,7 +43,7 @@ int cmd_write_tree(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, cmd_prefix, write_tree_options,\n \t\t\t     write_tree_usage, 0);\n \ndiff --git a/config.h b/config.h\nindex 29a02774837..6b729fc6bbf 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline void git_config(config_fn_t fn, void *data)\n-{\n-\trepo_config(the_repository, fn, data);\n-}\n-\n static inline void git_config_clear(void)\n {\n \trepo_config_clear(the_repository);\ndiff --git a/connect.c b/connect.c\nindex e77287f426c..4b1dc65e5ce 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -1028,7 +1028,7 @@ static int git_proxy_command_options(const char *var, const char *value,\n static int git_use_proxy(const char *host)\n {\n \tgit_proxy_command = getenv(\"GIT_PROXY_COMMAND\");\n-\tgit_config(git_proxy_command_options, (void*)host);\n+\trepo_config(the_repository, git_proxy_command_options, (void*)host);\n \treturn (git_proxy_command && *git_proxy_command);\n }\n \ndiff --git a/contrib/coccinelle/config_fn_ctx.pending.cocci b/contrib/coccinelle/config_fn_ctx.pending.cocci\nindex 6d3d1000a96..54f09fcbcde 100644\n--- a/contrib/coccinelle/config_fn_ctx.pending.cocci\n+++ b/contrib/coccinelle/config_fn_ctx.pending.cocci\n@@ -83,7 +83,7 @@ int fn(const char *C1, const char *C2,\n \n \n // The previous rules don't catch all callbacks, especially if they're defined\n-// in a separate file from the git_config() call. Fix these manually.\n+// in a separate file from the repo_config() call. Fix these manually.\n @@\n identifier C1, C2, D;\n attribute name UNUSED;\ndiff --git a/convert.c b/convert.c\nindex b5f7cf6306c..c7d6a85c226 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -1326,7 +1326,7 @@ void convert_attrs(struct index_state *istate,\n \t\t\t\t\t \"eol\", \"text\", \"working-tree-encoding\",\n \t\t\t\t\t NULL);\n \t\tuser_convert_tail = &user_convert;\n-\t\tgit_config(read_convert_config, NULL);\n+\t\trepo_config(the_repository, read_convert_config, NULL);\n \t}\n \n \tgit_check_attr(istate, path, check);\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 01d3699c4b7..11344206f73 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1916,7 +1916,7 @@ static void fetch_pack_config(void)\n \t\t}\n \t}\n \n-\tgit_config(fetch_pack_config_cb, NULL);\n+\trepo_config(the_repository, fetch_pack_config_cb, NULL);\n }\n \n static void fetch_pack_setup(void)\ndiff --git a/fsck.h b/fsck.h\nindex 0c5869ac34e..dd7df3d5b36 100644\n--- a/fsck.h\n+++ b/fsck.h\n@@ -287,7 +287,7 @@ const char *fsck_describe_object(struct fsck_options *options,\n \n struct key_value_info;\n /*\n- * git_config() callback for use by fsck-y tools that want to support\n+ * repo_config() callback for use by fsck-y tools that want to support\n  * fsck.<msg> fsck.skipList etc.\n  */\n int git_fsck_config(const char *var, const char *value,\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex bdcc8c2a2ed..bc0c21ebab1 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -25,7 +25,7 @@ static void gpg_interface_lazy_init(void)\n \tif (done)\n \t\treturn;\n \tdone = 1;\n-\tgit_config(git_gpg_config, NULL);\n+\trepo_config(the_repository, git_gpg_config, NULL);\n }\n \n static char *configured_signing_key;\ndiff --git a/help.c b/help.c\nindex 652efebf00c..db62cda4442 100644\n--- a/help.c\n+++ b/help.c\n@@ -332,7 +332,7 @@ static int get_colopts(const char *var, const char *value,\n void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds)\n {\n \tunsigned int colopts = 0;\n-\tgit_config(get_colopts, &colopts);\n+\trepo_config(the_repository, get_colopts, &colopts);\n \n \tif (main_cmds->cnt) {\n \t\tconst char *exec_path = git_exec_path();\n@@ -502,7 +502,7 @@ static void list_all_cmds_help_aliases(int longest)\n \tstruct cmdname_help *aliases;\n \tint i;\n \n-\tgit_config(get_alias, &alias_list);\n+\trepo_config(the_repository, get_alias, &alias_list);\n \tstring_list_sort(&alias_list);\n \n \tfor (i = 0; i < alias_list.nr; i++) {\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 02ab80533f0..17b9fe4ff8c 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -150,7 +150,7 @@ int cmd_main(int argc, const char **argv)\n \n \ttrace2_cmd_name(\"http-fetch\");\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tif (packfile) {\n \t\tif (!index_pack_args.nr)\ndiff --git a/http.c b/http.c\nindex 9b62f627dc5..d94e8f63b57 100644\n--- a/http.c\n+++ b/http.c\n@@ -1315,7 +1315,7 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)\n \thttp_is_verbose = 0;\n \tnormalized_url = url_normalize(url, &config.url);\n \n-\tgit_config(urlmatch_config_entry, &config);\n+\trepo_config(the_repository, urlmatch_config_entry, &config);\n \tfree(normalized_url);\n \tstring_list_clear(&config.vars, 1);\n \ndiff --git a/imap-send.c b/imap-send.c\nindex f5a656ac71d..9b26c669c01 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -1776,7 +1776,7 @@ int cmd_main(int argc, const char **argv)\n \tint ret;\n \n \tsetup_git_directory_gently(&nongit_ok);\n-\tgit_config(git_imap_config, &server);\n+\trepo_config(the_repository, git_imap_config, &server);\n \n \targc = parse_options(argc, (const char **)argv, \"\", imap_send_options, imap_send_usage, 0);\n \ndiff --git a/ls-refs.c b/ls-refs.c\nindex e28c8413758..c47acde07f3 100644\n--- a/ls-refs.c\n+++ b/ls-refs.c\n@@ -159,7 +159,7 @@ int ls_refs(struct repository *r, struct packet_reader *request)\n \tstrbuf_init(&data.buf, 0);\n \tstrvec_init(&data.hidden_refs);\n \n-\tgit_config(ls_refs_config, &data);\n+\trepo_config(the_repository, ls_refs_config, &data);\n \n \twhile (packet_reader_read(request) == PACKET_READ_NORMAL) {\n \t\tconst char *arg = request->line;\ndiff --git a/merge-ll.c b/merge-ll.c\nindex b2dc26da4fe..fafe2c91971 100644\n--- a/merge-ll.c\n+++ b/merge-ll.c\n@@ -357,7 +357,7 @@ static void initialize_ll_merge(void)\n \tif (ll_user_merge_tail)\n \t\treturn;\n \tll_user_merge_tail = &ll_user_merge;\n-\tgit_config(read_merge_config, NULL);\n+\trepo_config(the_repository, read_merge_config, NULL);\n }\n \n static const struct ll_merge_driver *find_ll_merge_driver(const char *merge_attr)\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 473ff61e36e..49aa37a8f23 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -5387,7 +5387,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)\n \t\t\tfree(value);\n \t\t}\n \t}\n-\tgit_config(git_xmerge_config, NULL);\n+\trepo_config(the_repository, git_xmerge_config, NULL);\n }\n \n static void init_merge_options(struct merge_options *opt,\ndiff --git a/notes-utils.c b/notes-utils.c\nindex ac66b82dd31..6a50c6d5646 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -162,7 +162,7 @@ struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd)\n \t\tc->refs_from_env = 1;\n \t\tstring_list_add_refs_from_colon_sep(c->refs, rewrite_refs_env);\n \t}\n-\tgit_config(notes_rewrite_config, c);\n+\trepo_config(the_repository, notes_rewrite_config, c);\n \tif (!c->enabled || !c->refs->nr) {\n \t\tstring_list_clear(c->refs, 0);\n \t\tfree(c->refs);\ndiff --git a/notes.c b/notes.c\nindex 97b995f3f2d..49393fbfd8d 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -1123,7 +1123,7 @@ void load_display_notes(struct display_notes_opt *opt)\n \t\t\tload_config_refs = 1;\n \t}\n \n-\tgit_config(notes_display_config, &load_config_refs);\n+\trepo_config(the_repository, notes_display_config, &load_config_refs);\n \n \tif (opt) {\n \t\tstruct string_list_item *item;\ndiff --git a/pretty.c b/pretty.c\nindex 0bc8ad8a9a8..cee96b9d94d 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -141,7 +141,7 @@ static void setup_commit_formats(void)\n \tCOPY_ARRAY(commit_formats, builtin_formats,\n \t\t   ARRAY_SIZE(builtin_formats));\n \n-\tgit_config(git_pretty_formats_config, NULL);\n+\trepo_config(the_repository, git_pretty_formats_config, NULL);\n }\n \n static struct cmt_fmt_map *find_commit_format_recursive(const char *sought,\ndiff --git a/refs/reftable-backend.c b/refs/reftable-backend.c\nindex 4c3817f4ec1..5134781d52d 100644\n--- a/refs/reftable-backend.c\n+++ b/refs/reftable-backend.c\n@@ -386,7 +386,7 @@ static struct ref_store *reftable_be_init(struct repository *repo,\n \trefs->write_options.lock_timeout_ms = 100;\n \trefs->write_options.fsync = reftable_be_fsync;\n \n-\tgit_config(reftable_be_config, &refs->write_options);\n+\trepo_config(the_repository, reftable_be_config, &refs->write_options);\n \n \t/*\n \t * It is somewhat unfortunate that we have to mirror the default block\ndiff --git a/rerere.c b/rerere.c\nindex 8bb97c98229..1ac2075144c 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -879,7 +879,7 @@ static void git_rerere_config(void)\n {\n \tgit_config_get_bool(\"rerere.enabled\", &rerere_enabled);\n \tgit_config_get_bool(\"rerere.autoupdate\", &rerere_autoupdate);\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n }\n \n static GIT_PATH_FUNC(git_path_rr_cache, \"rr-cache\")\n@@ -1247,7 +1247,7 @@ void rerere_gc(struct repository *r, struct string_list *rr)\n \t\t\t\t       &cutoff_resolve, now);\n \trepo_config_get_expiry_in_days(the_repository, \"gc.rerereunresolved\",\n \t\t\t\t       &cutoff_noresolve, now);\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \tdir = opendir(repo_git_path_replace(the_repository, &buf, \"rr-cache\"));\n \tif (!dir)\n \t\tdie_errno(_(\"unable to open rr-cache directory\"));\ndiff --git a/revision.c b/revision.c\nindex 0ca6a297a6b..ad63c100eb9 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1636,7 +1636,7 @@ void exclude_hidden_refs(struct ref_exclusions *exclusions, const char *section)\n \tcb.exclusions = exclusions;\n \tcb.section = section;\n \n-\tgit_config(hide_refs_config, &cb);\n+\trepo_config(the_repository, hide_refs_config, &cb);\n }\n \n struct all_refs_cb {\ndiff --git a/scalar.c b/scalar.c\nindex 0dc79fa9fb0..3b713abca3c 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -713,7 +713,7 @@ static int cmd_reconfigure(int argc, const char **argv)\n \t\t\t    maintenance_str);\n \t}\n \n-\tgit_config(get_scalar_repos, &scalar_repos);\n+\trepo_config(the_repository, get_scalar_repos, &scalar_repos);\n \n \tfor (size_t i = 0; i < scalar_repos.nr; i++) {\n \t\tint succeeded = 0;\ndiff --git a/sequencer.c b/sequencer.c\nindex 67e4310edcf..df207f33e07 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -327,7 +327,7 @@ static int git_sequencer_config(const char *k, const char *v,\n void sequencer_init_config(struct replay_opts *opts)\n {\n \topts->default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE;\n-\tgit_config(git_sequencer_config, opts);\n+\trepo_config(the_repository, git_sequencer_config, opts);\n }\n \n static inline int is_rebase_i(const struct replay_opts *opts)\ndiff --git a/setup.c b/setup.c\nindex 6f52dab64ca..91a3affdd8f 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -2339,7 +2339,7 @@ static int create_default_files(const char *template_path,\n \tcopy_templates(template_path);\n \tgit_config_clear();\n \trepo_settings_reset_shared_repository(the_repository);\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \treinit = is_reinit();\n \n@@ -2610,7 +2610,7 @@ int init_db(const char *git_dir, const char *real_git_dir,\n \t * have set up the repository format such that we can evaluate\n \t * includeIf conditions correctly in the case of re-initialization.\n \t */\n-\tgit_config(platform_core_config, NULL);\n+\trepo_config(the_repository, platform_core_config, NULL);\n \n \tsafe_create_dir(the_repository, git_dir, 0);\n \ndiff --git a/t/helper/test-advise.c b/t/helper/test-advise.c\nindex 6967c8e25c6..77c15a46cfa 100644\n--- a/t/helper/test-advise.c\n+++ b/t/helper/test-advise.c\n@@ -11,7 +11,7 @@ int cmd__advise_if_enabled(int argc, const char **argv)\n \t\tdie(\"usage: %s <advice>\", argv[0]);\n \n \tsetup_git_directory();\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \t/*\n \t * Any advice type can be used for testing, but NESTED_TAG was\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 75e028ab2a0..41ba8647900 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -32,10 +32,10 @@\n  * \t\t\t\tascending order of priority from a config_set\n  * \t\t\t\tconstructed from files entered as arguments.\n  *\n- * iterate -> iterate over all values using git_config(), and print some\n+ * iterate -> iterate over all values using repo_config(), and print some\n  *            data for each\n  *\n- * git_config_int -> iterate over all values using git_config() and print the\n+ * git_config_int -> iterate over all values using repo_config() and print the\n  *                   integer value for the entered key or die\n  *\n  * Examples:\n@@ -218,10 +218,10 @@ int cmd__config(int argc, const char **argv)\n \t\t\tgoto exit1;\n \t\t}\n \t} else if (!strcmp(argv[1], \"iterate\")) {\n-\t\tgit_config(iterate_cb, NULL);\n+\t\trepo_config(the_repository, iterate_cb, NULL);\n \t\tgoto exit0;\n \t} else if (argc == 3 && !strcmp(argv[1], \"git_config_int\")) {\n-\t\tgit_config(parse_int_cb, (void *) argv[2]);\n+\t\trepo_config(the_repository, parse_int_cb, (void *) argv[2]);\n \t\tgoto exit0;\n \t}\n \ndiff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c\nindex e277dde8e71..b2da48eda05 100644\n--- a/t/helper/test-read-cache.c\n+++ b/t/helper/test-read-cache.c\n@@ -19,7 +19,7 @@ int cmd__read_cache(int argc, const char **argv)\n \tif (argc == 2)\n \t\tcnt = strtol(argv[1], NULL, 0);\n \tsetup_git_directory();\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tfor (i = 0; i < cnt; i++) {\n \t\trepo_read_index(the_repository);\ndiff --git a/t/helper/test-userdiff.c b/t/helper/test-userdiff.c\nindex 94c48ababbe..aa3a9894d25 100644\n--- a/t/helper/test-userdiff.c\n+++ b/t/helper/test-userdiff.c\n@@ -41,7 +41,7 @@ int cmd__userdiff(int argc, const char **argv)\n \n \tif (want & USERDIFF_DRIVER_TYPE_CUSTOM) {\n \t\tsetup_git_directory();\n-\t\tgit_config(cmd__userdiff_config, NULL);\n+\t\trepo_config(the_repository, cmd__userdiff_config, NULL);\n \t}\n \n \tfor_each_userdiff_driver(driver_cb, &want);\ndiff --git a/t/t4256/1/mailinfo.c b/t/t4256/1/mailinfo.c\nindex b395adbdf2a..39caeba8653 100644\n--- a/t/t4256/1/mailinfo.c\n+++ b/t/t4256/1/mailinfo.c\n@@ -1214,7 +1214,7 @@ void setup_mailinfo(struct mailinfo *mi)\n \tmi->header_stage = 1;\n \tmi->use_inbody_headers = 1;\n \tmi->content_top = mi->content;\n-\tgit_config(git_mailinfo_config, mi);\n+\trepo_config(the_repository, git_mailinfo_config, mi);\n }\n \n void clear_mailinfo(struct mailinfo *mi)\ndiff --git a/t/t4256/1/mailinfo.c.orig b/t/t4256/1/mailinfo.c.orig\nindex 3281a37d518..b76eb866aae 100644\n--- a/t/t4256/1/mailinfo.c.orig\n+++ b/t/t4256/1/mailinfo.c.orig\n@@ -1154,7 +1154,7 @@ void setup_mailinfo(struct mailinfo *mi)\n \tmi->header_stage = 1;\n \tmi->use_inbody_headers = 1;\n \tmi->content_top = mi->content;\n-\tgit_config(git_mailinfo_config, mi);\n+\trepo_config(the_repository, git_mailinfo_config, mi);\n }\n \n void clear_mailinfo(struct mailinfo *mi)\ndiff --git a/trailer.c b/trailer.c\nindex 310cf582dc3..911a81ed993 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -595,8 +595,8 @@ void trailer_config_init(void)\n \tdefault_conf_info.where = WHERE_END;\n \tdefault_conf_info.if_exists = EXISTS_ADD_IF_DIFFERENT_NEIGHBOR;\n \tdefault_conf_info.if_missing = MISSING_ADD;\n-\tgit_config(git_trailer_default_config, NULL);\n-\tgit_config(git_trailer_config, NULL);\n+\trepo_config(the_repository, git_trailer_default_config, NULL);\n+\trepo_config(the_repository, git_trailer_config, NULL);\n \tconfigured = 1;\n }\n \ndiff --git a/transport.c b/transport.c\nindex c123ac1e38b..a246afd09fa 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -202,7 +202,7 @@ static int fetch_refs_from_bundle(struct transport *transport,\n \tif (!data->get_refs_from_bundle_called)\n \t\tget_refs_from_bundle_inner(transport);\n \n-\tgit_config(fetch_fsck_config_cb, &msg_types);\n+\trepo_config(the_repository, fetch_fsck_config_cb, &msg_types);\n \topts.fsck_msg_types = msg_types.buf;\n \n \tret = unbundle(the_repository, &data->header, data->fd,\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522185","messageId":"20250717-pks-config-wo-the-repository-v1-2-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 02/21] config: drop `git_config_clear()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:22Z","receivedAt":"2025-07-17T10:49:37Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_clear()`. All\ncallsites are adjusted so that they use\n`repo_config_clear(the_repository, ...)` instead. While some callsites\nmight already have a repository available, this mechanical conversion is\nthe exact same as the current situation and thus cannot cause any\nregression. Those sites should eventually be cleaned up in a later patch\nseries.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n config.h | 5 -----\n scalar.c | 2 +-\n setup.c  | 4 ++--\n 3 files changed, 3 insertions(+), 8 deletions(-)\n\ndiff --git a/config.h b/config.h\nindex 6b729fc6bbf..4eea99e9b95 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline void git_config_clear(void)\n-{\n-\trepo_config_clear(the_repository);\n-}\n-\n static inline int git_config_get(const char *key)\n {\n \treturn repo_config_get(the_repository, key);\ndiff --git a/scalar.c b/scalar.c\nindex 3b713abca3c..2aaff5aa109 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -763,7 +763,7 @@ static int cmd_reconfigure(int argc, const char **argv)\n \t\t\tbreak;\n \t\t}\n \n-\t\tgit_config_clear();\n+\t\trepo_config_clear(the_repository);\n \n \t\tif (repo_init(&r, gitdir.buf, commondir.buf))\n \t\t\tgoto loop_end;\ndiff --git a/setup.c b/setup.c\nindex 91a3affdd8f..9661c5d5d5d 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1741,7 +1741,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t * configuration (including the per-repo config file that we\n \t * ignored previously).\n \t */\n-\tgit_config_clear();\n+\trepo_config_clear(the_repository);\n \n \t/*\n \t * Let's assume that we are in a git repository.\n@@ -2337,7 +2337,7 @@ static int create_default_files(const char *template_path,\n \t * disk).\n \t */\n \tcopy_templates(template_path);\n-\tgit_config_clear();\n+\trepo_config_clear(the_repository);\n \trepo_settings_reset_shared_repository(the_repository);\n \trepo_config(the_repository, git_default_config, NULL);\n \n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522186","messageId":"20250717-pks-config-wo-the-repository-v1-3-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 03/21] config: drop `git_config_get()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:23Z","receivedAt":"2025-07-17T10:49:40Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get()`. All\ncallsites are adjusted so that they use `repo_config_get(the_repository,\n...)` instead. While some callsites might already have a repository\navailable, this mechanical conversion is the exact same as the current\nsituation and thus cannot cause any regression. Those sites should\neventually be cleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/gc.c                | 2 +-\n builtin/submodule--helper.c | 6 +++---\n config.h                    | 5 -----\n t/helper/test-config.c      | 2 +-\n 4 files changed, 5 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex d9e3b9d2ec3..e5c3d082eda 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -1916,7 +1916,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,\n \tgit_config_set(\"maintenance.auto\", \"false\");\n \n \t/* Set maintenance strategy, if unset */\n-\tif (git_config_get(\"maintenance.strategy\"))\n+\tif (repo_config_get(the_repository, \"maintenance.strategy\"))\n \t\tgit_config_set(\"maintenance.strategy\", \"incremental\");\n \n \tif (!git_config_get_string_multi(key, &list)) {\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 89ee09abea6..6bcc741a6ac 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -549,7 +549,7 @@ static int module_init(int argc, const char **argv, const char *prefix,\n \t * If there are no path args and submodule.active is set then,\n \t * by default, only initialize 'active' modules.\n \t */\n-\tif (!argc && !git_config_get(\"submodule.active\"))\n+\tif (!argc && !repo_config_get(the_repository, \"submodule.active\"))\n \t\tmodule_list_active(&list);\n \n \tinfo.prefix = prefix;\n@@ -2878,7 +2878,7 @@ static int module_update(int argc, const char **argv, const char *prefix,\n \t\t * If there are no path args and submodule.active is set then,\n \t\t * by default, only initialize 'active' modules.\n \t\t */\n-\t\tif (!argc && !git_config_get(\"submodule.active\"))\n+\t\tif (!argc && !repo_config_get(the_repository, \"submodule.active\"))\n \t\t\tmodule_list_active(&list);\n \n \t\tinfo.prefix = opt.prefix;\n@@ -3349,7 +3349,7 @@ static void configure_added_submodule(struct add_data *add_data)\n \t * is_submodule_active(), since that function needs to find\n \t * out the value of \"submodule.active\" again anyway.\n \t */\n-\tif (!git_config_get(\"submodule.active\")) {\n+\tif (!repo_config_get(the_repository, \"submodule.active\")) {\n \t\t/*\n \t\t * If the submodule being added isn't already covered by the\n \t\t * current configured pathspec, set the submodule's active flag\ndiff --git a/config.h b/config.h\nindex 4eea99e9b95..9261ed0f8d7 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get(const char *key)\n-{\n-\treturn repo_config_get(the_repository, key);\n-}\n-\n static inline int git_config_get_value(const char *key, const char **value)\n {\n \treturn repo_config_get_value(the_repository, key, value);\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 41ba8647900..cacf6f306b1 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -137,7 +137,7 @@ int cmd__config(int argc, const char **argv)\n \t} else if (argc == 3 && !strcmp(argv[1], \"get\")) {\n \t\tint ret;\n \n-\t\tif (!(ret = git_config_get(argv[2])))\n+\t\tif (!(ret = repo_config_get(the_repository, argv[2])))\n \t\t\tgoto exit0;\n \t\telse if (ret == 1)\n \t\t\tprintf(\"Value not found for \\\"%s\\\"\\n\", argv[2]);\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522187","messageId":"20250717-pks-config-wo-the-repository-v1-4-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 04/21] config: drop `git_config_get_value()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:24Z","receivedAt":"2025-07-17T10:49:43Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_value()`. All\ncallsites are adjusted so that they use\n`repo_config_get_value(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/gc.c           | 4 ++--\n builtin/pull.c         | 6 +++---\n config.h               | 5 -----\n rebase-interactive.c   | 2 +-\n t/helper/test-config.c | 2 +-\n 5 files changed, 7 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex e5c3d082eda..e94931ff48f 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -114,7 +114,7 @@ static int gc_config_is_timestamp_never(const char *var)\n \tconst char *value;\n \ttimestamp_t expire;\n \n-\tif (!git_config_get_value(var, &value) && value) {\n+\tif (!repo_config_get_value(the_repository, var, &value) && value) {\n \t\tif (parse_expiry_date(value, &expire))\n \t\t\tdie(_(\"failed to parse '%s' value '%s'\"), var, value);\n \t\treturn expire == 0;\n@@ -178,7 +178,7 @@ static void gc_config(struct gc_config *cfg)\n \tchar *owned = NULL;\n \tunsigned long ulongval;\n \n-\tif (!git_config_get_value(\"gc.packrefs\", &value)) {\n+\tif (!repo_config_get_value(the_repository, \"gc.packrefs\", &value)) {\n \t\tif (value && !strcmp(value, \"notbare\"))\n \t\t\tcfg->pack_refs = -1;\n \t\telse\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex d13ed9b5176..5ea51c31f58 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -312,7 +312,7 @@ static const char *config_get_ff(void)\n {\n \tconst char *value;\n \n-\tif (git_config_get_value(\"pull.ff\", &value))\n+\tif (repo_config_get_value(the_repository, \"pull.ff\", &value))\n \t\treturn NULL;\n \n \tswitch (git_parse_maybe_bool(value)) {\n@@ -343,7 +343,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)\n \tif (curr_branch) {\n \t\tchar *key = xstrfmt(\"branch.%s.rebase\", curr_branch->name);\n \n-\t\tif (!git_config_get_value(key, &value)) {\n+\t\tif (!repo_config_get_value(the_repository, key, &value)) {\n \t\t\tenum rebase_type ret = parse_config_rebase(key, value, 1);\n \t\t\tfree(key);\n \t\t\treturn ret;\n@@ -352,7 +352,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)\n \t\tfree(key);\n \t}\n \n-\tif (!git_config_get_value(\"pull.rebase\", &value))\n+\tif (!repo_config_get_value(the_repository, \"pull.rebase\", &value))\n \t\treturn parse_config_rebase(\"pull.rebase\", value, 1);\n \n \t*rebase_unspecified = 1;\ndiff --git a/config.h b/config.h\nindex 9261ed0f8d7..5dc330b88b1 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_value(const char *key, const char **value)\n-{\n-\treturn repo_config_get_value(the_repository, key, value);\n-}\n-\n static inline int git_config_get_value_multi(const char *key, const struct string_list **dest)\n {\n \treturn repo_config_get_value_multi(the_repository, key, dest);\ndiff --git a/rebase-interactive.c b/rebase-interactive.c\nindex cbeb8641477..809f76a87b8 100644\n--- a/rebase-interactive.c\n+++ b/rebase-interactive.c\n@@ -30,7 +30,7 @@ static enum missing_commit_check_level get_missing_commit_check_level(void)\n {\n \tconst char *value;\n \n-\tif (git_config_get_value(\"rebase.missingcommitscheck\", &value) ||\n+\tif (repo_config_get_value(the_repository, \"rebase.missingcommitscheck\", &value) ||\n \t\t\t!strcasecmp(\"ignore\", value))\n \t\treturn MISSING_COMMIT_CHECK_IGNORE;\n \tif (!strcasecmp(\"warn\", value))\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex cacf6f306b1..99c91512173 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -110,7 +110,7 @@ int cmd__config(int argc, const char **argv)\n \t\tfprintf(stderr, \"Please, provide a command name on the command-line\\n\");\n \t\tgoto exit1;\n \t} else if (argc == 3 && !strcmp(argv[1], \"get_value\")) {\n-\t\tif (!git_config_get_value(argv[2], &v)) {\n+\t\tif (!repo_config_get_value(the_repository, argv[2], &v)) {\n \t\t\tif (!v)\n \t\t\t\tprintf(\"(NULL)\\n\");\n \t\t\telse\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522188","messageId":"20250717-pks-config-wo-the-repository-v1-5-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 05/21] config: drop `git_config_get_value()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:25Z","receivedAt":"2025-07-17T10:49:47Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_value()`. All\ncallsites are adjusted so that they use\n`repo_config_get_value(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n config.h               | 5 -----\n t/helper/test-config.c | 2 +-\n 2 files changed, 1 insertion(+), 6 deletions(-)\n\ndiff --git a/config.h b/config.h\nindex 5dc330b88b1..e90c1c4d335 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_value_multi(const char *key, const struct string_list **dest)\n-{\n-\treturn repo_config_get_value_multi(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_string_multi(const char *key,\n \t\t\t\tconst struct string_list **dest)\n {\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 99c91512173..1953ab846e4 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -121,7 +121,7 @@ int cmd__config(int argc, const char **argv)\n \t\t\tgoto exit1;\n \t\t}\n \t} else if (argc == 3 && !strcmp(argv[1], \"get_value_multi\")) {\n-\t\tif (!git_config_get_value_multi(argv[2], &strptr)) {\n+\t\tif (!repo_config_get_value_multi(the_repository, argv[2], &strptr)) {\n \t\t\tfor (i = 0; i < strptr->nr; i++) {\n \t\t\t\tv = strptr->items[i].string;\n \t\t\t\tif (!v)\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522189","messageId":"20250717-pks-config-wo-the-repository-v1-6-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 06/21] config: drop `git_config_get_string_multi()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:26Z","receivedAt":"2025-07-17T10:49:50Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove\n`git_config_get_string_multi()`. All callsites are adjusted so that they\nuse `repo_config_get_string_multi(the_repository, ...)` instead. While\nsome callsites might already have a repository available, this\nmechanical conversion is the exact same as the current situation and\nthus cannot cause any regression. Those sites should eventually be\ncleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/gc.c  | 4 ++--\n builtin/log.c | 2 +-\n config.h      | 6 ------\n reachable.c   | 2 +-\n versioncmp.c  | 4 ++--\n 5 files changed, 6 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex e94931ff48f..f395cc57a15 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -1919,7 +1919,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,\n \tif (repo_config_get(the_repository, \"maintenance.strategy\"))\n \t\tgit_config_set(\"maintenance.strategy\", \"incremental\");\n \n-\tif (!git_config_get_string_multi(key, &list)) {\n+\tif (!repo_config_get_string_multi(the_repository, key, &list)) {\n \t\tfor_each_string_list_item(item, list) {\n \t\t\tif (!strcmp(maintpath, item->string)) {\n \t\t\t\tfound = 1;\n@@ -1988,7 +1988,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi\n \t}\n \tif (!(config_file\n \t      ? git_configset_get_string_multi(&cs, key, &list)\n-\t      : git_config_get_string_multi(key, &list))) {\n+\t      : repo_config_get_string_multi(the_repository, key, &list))) {\n \t\tfor_each_string_list_item(item, list) {\n \t\t\tif (!strcmp(maintpath, item->string)) {\n \t\t\t\tfound = 1;\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 1bedc4ef355..b512f12e805 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -221,7 +221,7 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f\n \tstruct string_list *include = decoration_filter->include_ref_pattern;\n \tconst struct string_list *config_exclude;\n \n-\tif (!git_config_get_string_multi(\"log.excludeDecoration\",\n+\tif (!repo_config_get_string_multi(the_repository, \"log.excludeDecoration\",\n \t\t\t\t\t &config_exclude)) {\n \t\tstruct string_list_item *item;\n \t\tfor_each_string_list_item(item, config_exclude)\ndiff --git a/config.h b/config.h\nindex e90c1c4d335..f6635e48c23 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,12 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_string_multi(const char *key,\n-\t\t\t\tconst struct string_list **dest)\n-{\n-\treturn repo_config_get_string_multi(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_string(const char *key, char **dest)\n {\n \treturn repo_config_get_string(the_repository, key, dest);\ndiff --git a/reachable.c b/reachable.c\nindex e984b68a0c4..8330a14fa82 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -170,7 +170,7 @@ static void load_gc_recent_objects(struct recent_data *data)\n \n \tdata->extra_recent_oids_loaded = 1;\n \n-\tif (git_config_get_string_multi(\"gc.recentobjectshook\", &programs))\n+\tif (repo_config_get_string_multi(the_repository, \"gc.recentobjectshook\", &programs))\n \t\treturn;\n \n \tfor (i = 0; i < programs->nr; i++) {\ndiff --git a/versioncmp.c b/versioncmp.c\nindex b6eebdb989c..3a81b17bc1b 100644\n--- a/versioncmp.c\n+++ b/versioncmp.c\n@@ -167,8 +167,8 @@ int versioncmp(const char *s1, const char *s2)\n \t\tconst char *const oldk = \"versionsort.prereleasesuffix\";\n \t\tconst struct string_list *newl;\n \t\tconst struct string_list *oldl;\n-\t\tint new = git_config_get_string_multi(newk, &newl);\n-\t\tint old = git_config_get_string_multi(oldk, &oldl);\n+\t\tint new = repo_config_get_string_multi(the_repository, newk, &newl);\n+\t\tint old = repo_config_get_string_multi(the_repository, oldk, &oldl);\n \n \t\tif (!new && !old)\n \t\t\twarning(\"ignoring %s because %s is set\", oldk, newk);\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522190","messageId":"20250717-pks-config-wo-the-repository-v1-7-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 07/21] config: drop `git_config_get_string()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:27Z","receivedAt":"2025-07-17T10:49:53Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_string()`.\nAll callsites are adjusted so that they use\n`repo_config_get_string(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n apply.c                     |  4 ++--\n branch.c                    |  2 +-\n builtin/gc.c                |  4 ++--\n builtin/log.c               |  2 +-\n builtin/notes.c             |  2 +-\n builtin/submodule--helper.c | 12 ++++++------\n config.h                    |  5 -----\n fetch-pack.c                |  2 +-\n merge-ort.c                 |  8 ++++----\n scalar.c                    |  4 ++--\n sequencer.c                 |  2 +-\n transport.c                 |  8 ++++----\n 12 files changed, 25 insertions(+), 30 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex d2381a157c0..45eb790d133 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -48,8 +48,8 @@ struct gitdiff_data {\n \n static void git_apply_config(void)\n {\n-\tgit_config_get_string(\"apply.whitespace\", &apply_default_whitespace);\n-\tgit_config_get_string(\"apply.ignorewhitespace\", &apply_default_ignorewhitespace);\n+\trepo_config_get_string(the_repository, \"apply.whitespace\", &apply_default_whitespace);\n+\trepo_config_get_string(the_repository, \"apply.ignorewhitespace\", &apply_default_ignorewhitespace);\n \trepo_config(the_repository, git_xmerge_config, NULL);\n }\n \ndiff --git a/branch.c b/branch.c\nindex 93f5b4e8dd9..b4811671fc7 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -355,7 +355,7 @@ int read_branch_desc(struct strbuf *buf, const char *branch_name)\n \tchar *v = NULL;\n \tstruct strbuf name = STRBUF_INIT;\n \tstrbuf_addf(&name, \"branch.%s.description\", branch_name);\n-\tif (git_config_get_string(name.buf, &v)) {\n+\tif (repo_config_get_string(the_repository, name.buf, &v)) {\n \t\tstrbuf_release(&name);\n \t\treturn -1;\n \t}\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex f395cc57a15..d8f7a1858cb 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -218,12 +218,12 @@ static void gc_config(struct gc_config *cfg)\n \tif (!git_config_get_ulong(\"core.deltabasecachelimit\", &ulongval))\n \t\tcfg->delta_base_cache_limit = ulongval;\n \n-\tif (!git_config_get_string(\"gc.repackfilter\", &owned)) {\n+\tif (!repo_config_get_string(the_repository, \"gc.repackfilter\", &owned)) {\n \t\tfree(cfg->repack_filter);\n \t\tcfg->repack_filter = owned;\n \t}\n \n-\tif (!git_config_get_string(\"gc.repackfilterto\", &owned)) {\n+\tif (!repo_config_get_string(the_repository, \"gc.repackfilterto\", &owned)) {\n \t\tfree(cfg->repack_filter_to);\n \t\tcfg->repack_filter_to = owned;\n \t}\ndiff --git a/builtin/log.c b/builtin/log.c\nindex b512f12e805..a9969ad00a0 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -235,7 +235,7 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f\n \t * since the command-line takes precedent.\n \t */\n \tif (use_default_decoration_filter &&\n-\t    !git_config_get_string(\"log.initialdecorationset\", &value) &&\n+\t    !repo_config_get_string(the_repository, \"log.initialdecorationset\", &value) &&\n \t    !strcmp(\"all\", value))\n \t\tuse_default_decoration_filter = 0;\n \tfree(value);\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 17004cdb10e..d2252cf5346 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -873,7 +873,7 @@ static int git_config_get_notes_strategy(const char *key,\n {\n \tchar *value;\n \n-\tif (git_config_get_string(key, &value))\n+\tif (repo_config_get_string(the_repository, key, &value))\n \t\treturn 1;\n \tif (parse_notes_merge_strategy(value, strategy))\n \t\tgit_die_config(the_repository, key, _(\"unknown notes merge strategy %s\"), value);\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 6bcc741a6ac..18aa69f0cae 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -53,7 +53,7 @@ static char *resolve_relative_url(const char *rel_url, const char *up_path, int\n \tstruct strbuf remotesb = STRBUF_INIT;\n \n \tstrbuf_addf(&remotesb, \"remote.%s.url\", remote);\n-\tif (git_config_get_string(remotesb.buf, &remoteurl)) {\n+\tif (repo_config_get_string(the_repository, remotesb.buf, &remoteurl)) {\n \t\tif (!quiet)\n \t\t\twarning(_(\"could not look up configuration '%s'. \"\n \t\t\t\t  \"Assuming this repository is its own \"\n@@ -468,7 +468,7 @@ static void init_submodule(const char *path, const char *prefix,\n \t * .gitmodules, so look it up directly.\n \t */\n \tstrbuf_addf(&sb, \"submodule.%s.url\", sub->name);\n-\tif (git_config_get_string(sb.buf, &url)) {\n+\tif (repo_config_get_string(the_repository, sb.buf, &url)) {\n \t\tif (!sub->url)\n \t\t\tdie(_(\"No url found for submodule path '%s' in .gitmodules\"),\n \t\t\t\tdisplaypath);\n@@ -1623,11 +1623,11 @@ static void prepare_possible_alternates(const char *sm_name,\n \tchar *sm_alternate = NULL, *error_strategy = NULL;\n \tstruct submodule_alternate_setup sas = SUBMODULE_ALTERNATE_SETUP_INIT;\n \n-\tgit_config_get_string(\"submodule.alternateLocation\", &sm_alternate);\n+\trepo_config_get_string(the_repository, \"submodule.alternateLocation\", &sm_alternate);\n \tif (!sm_alternate)\n \t\treturn;\n \n-\tgit_config_get_string(\"submodule.alternateErrorStrategy\", &error_strategy);\n+\trepo_config_get_string(the_repository, \"submodule.alternateErrorStrategy\", &error_strategy);\n \n \tif (!error_strategy)\n \t\terror_strategy = xstrdup(\"die\");\n@@ -1808,11 +1808,11 @@ static int clone_submodule(const struct module_clone_data *clone_data,\n \t\tdie(_(\"could not get submodule directory for '%s'\"), clone_data_path);\n \n \t/* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */\n-\tgit_config_get_string(\"submodule.alternateLocation\", &sm_alternate);\n+\trepo_config_get_string(the_repository, \"submodule.alternateLocation\", &sm_alternate);\n \tif (sm_alternate)\n \t\tgit_config_set_in_file(p, \"submodule.alternateLocation\",\n \t\t\t\t       sm_alternate);\n-\tgit_config_get_string(\"submodule.alternateErrorStrategy\", &error_strategy);\n+\trepo_config_get_string(the_repository, \"submodule.alternateErrorStrategy\", &error_strategy);\n \tif (error_strategy)\n \t\tgit_config_set_in_file(p, \"submodule.alternateErrorStrategy\",\n \t\t\t\t       error_strategy);\ndiff --git a/config.h b/config.h\nindex f6635e48c23..8887ebf62ea 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_string(const char *key, char **dest)\n-{\n-\treturn repo_config_get_string(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_string_tmp(const char *key, const char **dest)\n {\n \treturn repo_config_get_string_tmp(the_repository, key, dest);\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 11344206f73..04768087879 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1910,7 +1910,7 @@ static void fetch_pack_config(void)\n \tif (!uri_protocols.nr) {\n \t\tchar *str;\n \n-\t\tif (!git_config_get_string(\"fetch.uriprotocols\", &str) && str) {\n+\t\tif (!repo_config_get_string(the_repository, \"fetch.uriprotocols\", &str) && str) {\n \t\t\tstring_list_split(&uri_protocols, str, ',', -1);\n \t\t\tfree(str);\n \t\t}\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 49aa37a8f23..29789579c9b 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -5358,15 +5358,15 @@ static void merge_recursive_config(struct merge_options *opt, int ui)\n \tgit_config_get_int(\"merge.renamelimit\", &opt->rename_limit);\n \tgit_config_get_bool(\"merge.renormalize\", &renormalize);\n \topt->renormalize = renormalize;\n-\tif (!git_config_get_string(\"diff.renames\", &value)) {\n+\tif (!repo_config_get_string(the_repository, \"diff.renames\", &value)) {\n \t\topt->detect_renames = git_config_rename(\"diff.renames\", value);\n \t\tfree(value);\n \t}\n-\tif (!git_config_get_string(\"merge.renames\", &value)) {\n+\tif (!repo_config_get_string(the_repository, \"merge.renames\", &value)) {\n \t\topt->detect_renames = git_config_rename(\"merge.renames\", value);\n \t\tfree(value);\n \t}\n-\tif (!git_config_get_string(\"merge.directoryrenames\", &value)) {\n+\tif (!repo_config_get_string(the_repository, \"merge.directoryrenames\", &value)) {\n \t\tint boolval = git_parse_maybe_bool(value);\n \t\tif (0 <= boolval) {\n \t\t\topt->detect_directory_renames = boolval ?\n@@ -5379,7 +5379,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)\n \t\tfree(value);\n \t}\n \tif (ui) {\n-\t\tif (!git_config_get_string(\"diff.algorithm\", &value)) {\n+\t\tif (!repo_config_get_string(the_repository, \"diff.algorithm\", &value)) {\n \t\t\tlong diff_algorithm = parse_algorithm_value(value);\n \t\t\tif (diff_algorithm < 0)\n \t\t\t\tdie(_(\"unknown value for config '%s': %s\"), \"diff.algorithm\", value);\ndiff --git a/scalar.c b/scalar.c\nindex 2aaff5aa109..07f855c9913 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -101,7 +101,7 @@ static int set_scalar_config(const struct scalar_config *config, int reconfigure\n \tint res;\n \n \tif ((reconfigure && config->overwrite_on_reconfigure) ||\n-\t    git_config_get_string(config->key, &value)) {\n+\t    repo_config_get_string(the_repository, config->key, &value)) {\n \t\ttrace2_data_string(\"scalar\", the_repository, config->key, \"created\");\n \t\tres = git_config_set_gently(config->key, config->value);\n \t} else {\n@@ -193,7 +193,7 @@ static int set_recommended_config(int reconfigure)\n \t * The `log.excludeDecoration` setting is special because it allows\n \t * for multiple values.\n \t */\n-\tif (git_config_get_string(\"log.excludeDecoration\", &value)) {\n+\tif (repo_config_get_string(the_repository, \"log.excludeDecoration\", &value)) {\n \t\ttrace2_data_string(\"scalar\", the_repository,\n \t\t\t\t   \"log.excludeDecoration\", \"created\");\n \t\tif (git_config_set_multivar_gently(\"log.excludeDecoration\",\ndiff --git a/sequencer.c b/sequencer.c\nindex df207f33e07..f3bada39b40 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -6089,7 +6089,7 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,\n \trevs.topo_order = 1;\n \n \trevs.pretty_given = 1;\n-\tgit_config_get_string(\"rebase.instructionFormat\", &format);\n+\trepo_config_get_string(the_repository, \"rebase.instructionFormat\", &format);\n \tif (!format || !*format) {\n \t\tfree(format);\n \t\tformat = xstrdup(\"# %s\");\ndiff --git a/transport.c b/transport.c\nindex a246afd09fa..89e6297ce22 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -54,14 +54,14 @@ static int transport_color_config(void)\n \t\treturn 0;\n \tinitialized = 1;\n \n-\tif (!git_config_get_string(key, &value))\n+\tif (!repo_config_get_string(the_repository, key, &value))\n \t\ttransport_use_color = git_config_colorbool(key, value);\n \n \tif (!want_color_stderr(transport_use_color))\n \t\treturn 0;\n \n \tfor (size_t i = 0; i < ARRAY_SIZE(keys); i++)\n-\t\tif (!git_config_get_string(keys[i], &value)) {\n+\t\tif (!repo_config_get_string(the_repository, keys[i], &value)) {\n \t\t\tif (!value)\n \t\t\t\treturn config_error_nonbool(keys[i]);\n \t\t\tif (color_parse(value, transport_colors[i]) < 0)\n@@ -1078,7 +1078,7 @@ static enum protocol_allow_config get_protocol_config(const char *type)\n \tchar *value;\n \n \t/* first check the per-protocol config */\n-\tif (!git_config_get_string(key, &value)) {\n+\tif (!repo_config_get_string(the_repository, key, &value)) {\n \t\tenum protocol_allow_config ret =\n \t\t\tparse_protocol_config(key, value);\n \t\tfree(key);\n@@ -1088,7 +1088,7 @@ static enum protocol_allow_config get_protocol_config(const char *type)\n \tfree(key);\n \n \t/* if defined, fallback to user-defined default for unknown protocols */\n-\tif (!git_config_get_string(\"protocol.allow\", &value)) {\n+\tif (!repo_config_get_string(the_repository, \"protocol.allow\", &value)) {\n \t\tenum protocol_allow_config ret =\n \t\t\tparse_protocol_config(\"protocol.allow\", value);\n \t\tfree(value);\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522191","messageId":"20250717-pks-config-wo-the-repository-v1-8-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 08/21] config: drop `git_config_get_string()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:28Z","receivedAt":"2025-07-17T10:49:56Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_string()`.\nAll callsites are adjusted so that they use\n`repo_config_get_string(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/fetch.c             | 2 +-\n builtin/gc.c                | 4 ++--\n builtin/remote.c            | 2 +-\n builtin/submodule--helper.c | 4 ++--\n checkout.c                  | 2 +-\n config.h                    | 5 -----\n connect.c                   | 4 ++--\n editor.c                    | 2 +-\n help.c                      | 2 +-\n promisor-remote.c           | 4 ++--\n protocol.c                  | 2 +-\n remote.c                    | 2 +-\n sideband.c                  | 6 +++---\n t/helper/test-config.c      | 2 +-\n 14 files changed, 19 insertions(+), 24 deletions(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex ea447c453d1..52eae4b972d 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -2508,7 +2508,7 @@ int cmd_fetch(int argc,\n \tif (!max_jobs)\n \t\tmax_jobs = online_cpus();\n \n-\tif (!git_config_get_string_tmp(\"fetch.bundleuri\", &bundle_uri) &&\n+\tif (!repo_config_get_string_tmp(the_repository, \"fetch.bundleuri\", &bundle_uri) &&\n \t    fetch_bundle_uri(the_repository, bundle_uri, NULL))\n \t\twarning(_(\"failed to fetch bundles from '%s'\"), bundle_uri);\n \ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex d8f7a1858cb..a2b8fbc9f3d 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -1765,7 +1765,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,\n \tif (opts->schedule) {\n \t\tstrategy = none_strategy;\n \n-\t\tif (!git_config_get_string_tmp(\"maintenance.strategy\", &config_str)) {\n+\t\tif (!repo_config_get_string_tmp(the_repository, \"maintenance.strategy\", &config_str)) {\n \t\t\tif (!strcasecmp(config_str, \"incremental\"))\n \t\t\t\tstrategy = incremental_strategy;\n \t\t}\n@@ -1788,7 +1788,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,\n \t\t\tstrbuf_reset(&config_name);\n \t\t\tstrbuf_addf(&config_name, \"maintenance.%s.schedule\",\n \t\t\t\t    tasks[i].name);\n-\t\t\tif (!git_config_get_string_tmp(config_name.buf, &config_str))\n+\t\t\tif (!repo_config_get_string_tmp(the_repository, config_name.buf, &config_str))\n \t\t\t\tstrategy.tasks[i].schedule = parse_schedule(config_str);\n \t\t\tif (strategy.tasks[i].schedule < opts->schedule)\n \t\t\t\tcontinue;\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex ebd70bea3a1..826b2dcfd04 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -1268,7 +1268,7 @@ static int get_one_entry(struct remote *remote, void *priv)\n \n \t\tstrbuf_addf(&promisor_config, \"remote.%s.partialclonefilter\", remote->name);\n \t\tstrbuf_addf(&remote_info_buf, \"%s (fetch)\", remote->url.v[0]);\n-\t\tif (!git_config_get_string_tmp(promisor_config.buf, &partial_clone_filter))\n+\t\tif (!repo_config_get_string_tmp(the_repository, promisor_config.buf, &partial_clone_filter))\n \t\t\tstrbuf_addf(&remote_info_buf, \" [%s]\", partial_clone_filter);\n \n \t\tstrbuf_release(&promisor_config);\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 18aa69f0cae..d2ab31835b5 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -496,7 +496,7 @@ static void init_submodule(const char *path, const char *prefix,\n \n \t/* Copy \"update\" setting when it is not set yet */\n \tstrbuf_addf(&sb, \"submodule.%s.update\", sub->name);\n-\tif (git_config_get_string_tmp(sb.buf, &upd) &&\n+\tif (repo_config_get_string_tmp(the_repository, sb.buf, &upd) &&\n \t    sub->update_strategy.type != SM_UPDATE_UNSPECIFIED) {\n \t\tif (sub->update_strategy.type == SM_UPDATE_COMMAND) {\n \t\t\tfprintf(stderr, _(\"warning: command update mode suggested for submodule '%s'\\n\"),\n@@ -1034,7 +1034,7 @@ static void prepare_submodule_summary(struct summary_cb *info,\n \n \t\t\tconfig_key = xstrfmt(\"submodule.%s.ignore\",\n \t\t\t\t\t     sub->name);\n-\t\t\tif (!git_config_get_string_tmp(config_key, &value))\n+\t\t\tif (!repo_config_get_string_tmp(the_repository, config_key, &value))\n \t\t\t\tignore_all = !strcmp(value, \"all\");\n \t\t\telse if (sub->ignore)\n \t\t\t\tignore_all = !strcmp(sub->ignore, \"all\");\ndiff --git a/checkout.c b/checkout.c\nindex 0b1cf8b40b7..1588b116eed 100644\n--- a/checkout.c\n+++ b/checkout.c\n@@ -52,7 +52,7 @@ char *unique_tracking_name(const char *name, struct object_id *oid,\n {\n \tstruct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT;\n \tconst char *default_remote = NULL;\n-\tif (!git_config_get_string_tmp(\"checkout.defaultremote\", &default_remote))\n+\tif (!repo_config_get_string_tmp(the_repository, \"checkout.defaultremote\", &default_remote))\n \t\tcb_data.default_remote = default_remote;\n \tcb_data.src_ref = xstrfmt(\"refs/heads/%s\", name);\n \tcb_data.dst_oid = oid;\ndiff --git a/config.h b/config.h\nindex 8887ebf62ea..89739bee9b0 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_string_tmp(const char *key, const char **dest)\n-{\n-\treturn repo_config_get_string_tmp(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_int(const char *key, int *dest)\n {\n \treturn repo_config_get_int(the_repository, key, dest);\ndiff --git a/connect.c b/connect.c\nindex 4b1dc65e5ce..34cac24d54c 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -1154,7 +1154,7 @@ static const char *get_ssh_command(void)\n \tif ((ssh = getenv(\"GIT_SSH_COMMAND\")))\n \t\treturn ssh;\n \n-\tif (!git_config_get_string_tmp(\"core.sshcommand\", &ssh))\n+\tif (!repo_config_get_string_tmp(the_repository, \"core.sshcommand\", &ssh))\n \t\treturn ssh;\n \n \treturn NULL;\n@@ -1173,7 +1173,7 @@ static void override_ssh_variant(enum ssh_variant *ssh_variant)\n {\n \tconst char *variant = getenv(\"GIT_SSH_VARIANT\");\n \n-\tif (!variant && git_config_get_string_tmp(\"ssh.variant\", &variant))\n+\tif (!variant && repo_config_get_string_tmp(the_repository, \"ssh.variant\", &variant))\n \t\treturn;\n \n \tif (!strcmp(variant, \"auto\"))\ndiff --git a/editor.c b/editor.c\nindex b79d97b0e72..fd174e6a034 100644\n--- a/editor.c\n+++ b/editor.c\n@@ -50,7 +50,7 @@ const char *git_sequence_editor(void)\n \tconst char *editor = getenv(\"GIT_SEQUENCE_EDITOR\");\n \n \tif (!editor)\n-\t\tgit_config_get_string_tmp(\"sequence.editor\", &editor);\n+\t\trepo_config_get_string_tmp(the_repository, \"sequence.editor\", &editor);\n \tif (!editor)\n \t\teditor = git_editor();\n \ndiff --git a/help.c b/help.c\nindex db62cda4442..bb20498cfd0 100644\n--- a/help.c\n+++ b/help.c\n@@ -417,7 +417,7 @@ void list_cmds_by_config(struct string_list *list)\n {\n \tconst char *cmd_list;\n \n-\tif (git_config_get_string_tmp(\"completion.commands\", &cmd_list))\n+\tif (repo_config_get_string_tmp(the_repository, \"completion.commands\", &cmd_list))\n \t\treturn;\n \n \tstring_list_sort(list);\ndiff --git a/promisor-remote.c b/promisor-remote.c\nindex be6f82d12f8..a9c877d9cfa 100644\n--- a/promisor-remote.c\n+++ b/promisor-remote.c\n@@ -327,7 +327,7 @@ static void promisor_info_vecs(struct repository *repo,\n \t\tchar *url_key = xstrfmt(\"remote.%s.url\", r->name);\n \n \t\t/* Only add remotes with a non empty URL */\n-\t\tif (!git_config_get_string_tmp(url_key, &url) && *url) {\n+\t\tif (!repo_config_get_string_tmp(the_repository, url_key, &url) && *url) {\n \t\t\tstrvec_push(names, r->name);\n \t\t\tstrvec_push(urls, url);\n \t\t}\n@@ -433,7 +433,7 @@ static void filter_promisor_remote(struct repository *repo,\n \tstruct strvec names = STRVEC_INIT;\n \tstruct strvec urls = STRVEC_INIT;\n \n-\tif (!git_config_get_string_tmp(\"promisor.acceptfromserver\", &accept_str)) {\n+\tif (!repo_config_get_string_tmp(the_repository, \"promisor.acceptfromserver\", &accept_str)) {\n \t\tif (!*accept_str || !strcasecmp(\"None\", accept_str))\n \t\t\taccept = ACCEPT_NONE;\n \t\telse if (!strcasecmp(\"KnownUrl\", accept_str))\ndiff --git a/protocol.c b/protocol.c\nindex bae7226ff40..65f66217021 100644\n--- a/protocol.c\n+++ b/protocol.c\n@@ -24,7 +24,7 @@ enum protocol_version get_protocol_version_config(void)\n \tconst char *git_test_k = \"GIT_TEST_PROTOCOL_VERSION\";\n \tconst char *git_test_v;\n \n-\tif (!git_config_get_string_tmp(\"protocol.version\", &value)) {\n+\tif (!repo_config_get_string_tmp(the_repository, \"protocol.version\", &value)) {\n \t\tenum protocol_version version = parse_protocol_version(value);\n \n \t\tif (version == protocol_unknown_version)\ndiff --git a/remote.c b/remote.c\nindex e965f022f12..88f991795b2 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -734,7 +734,7 @@ static void validate_remote_url(struct remote *remote)\n \tstruct strbuf redacted = STRBUF_INIT;\n \tint warn_not_die;\n \n-\tif (git_config_get_string_tmp(\"transfer.credentialsinurl\", &value))\n+\tif (repo_config_get_string_tmp(the_repository, \"transfer.credentialsinurl\", &value))\n \t\treturn;\n \n \tif (!strcmp(\"warn\", value))\ndiff --git a/sideband.c b/sideband.c\nindex 251e9615ed0..8f15b98a654 100644\n--- a/sideband.c\n+++ b/sideband.c\n@@ -39,9 +39,9 @@ static int use_sideband_colors(void)\n \tif (use_sideband_colors_cached >= 0)\n \t\treturn use_sideband_colors_cached;\n \n-\tif (!git_config_get_string_tmp(key, &value))\n+\tif (!repo_config_get_string_tmp(the_repository, key, &value))\n \t\tuse_sideband_colors_cached = git_config_colorbool(key, value);\n-\telse if (!git_config_get_string_tmp(\"color.ui\", &value))\n+\telse if (!repo_config_get_string_tmp(the_repository, \"color.ui\", &value))\n \t\tuse_sideband_colors_cached = git_config_colorbool(\"color.ui\", value);\n \telse\n \t\tuse_sideband_colors_cached = GIT_COLOR_AUTO;\n@@ -49,7 +49,7 @@ static int use_sideband_colors(void)\n \tfor (i = 0; i < ARRAY_SIZE(keywords); i++) {\n \t\tstrbuf_reset(&sb);\n \t\tstrbuf_addf(&sb, \"%s.%s\", key, keywords[i].keyword);\n-\t\tif (git_config_get_string_tmp(sb.buf, &value))\n+\t\tif (repo_config_get_string_tmp(the_repository, sb.buf, &value))\n \t\t\tcontinue;\n \t\tcolor_parse(value, keywords[i].color);\n \t}\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 1953ab846e4..30e70f1a6c2 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -171,7 +171,7 @@ int cmd__config(int argc, const char **argv)\n \t\t\tgoto exit1;\n \t\t}\n \t} else if (argc == 3 && !strcmp(argv[1], \"get_string\")) {\n-\t\tif (!git_config_get_string_tmp(argv[2], &v)) {\n+\t\tif (!repo_config_get_string_tmp(the_repository, argv[2], &v)) {\n \t\t\tprintf(\"%s\\n\", v);\n \t\t\tgoto exit0;\n \t\t} else {\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522192","messageId":"20250717-pks-config-wo-the-repository-v1-9-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 09/21] config: drop `git_config_get_int()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:29Z","receivedAt":"2025-07-17T10:49:59Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_int()`. All\ncallsites are adjusted so that they use\n`repo_config_get_int(the_repository, ...)` instead. While some callsites\nmight already have a repository available, this mechanical conversion is\nthe exact same as the current situation and thus cannot cause any\nregression. Those sites should eventually be cleaned up in a later patch\nseries.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/credential-store.c |  2 +-\n builtin/fast-import.c      |  6 +++---\n builtin/fetch.c            |  4 ++--\n builtin/gc.c               | 26 +++++++++++++-------------\n config.h                   |  5 -----\n fetch-pack.c               |  4 ++--\n fsmonitor.c                |  2 +-\n merge-ort.c                |  6 +++---\n parallel-checkout.c        |  4 ++--\n refs.c                     |  2 +-\n refs/packed-backend.c      |  2 +-\n sequencer.c                |  2 +-\n t/helper/test-config.c     |  2 +-\n 13 files changed, 31 insertions(+), 36 deletions(-)\n\ndiff --git a/builtin/credential-store.c b/builtin/credential-store.c\nindex e669e99dbfb..b74e06cc93d 100644\n--- a/builtin/credential-store.c\n+++ b/builtin/credential-store.c\n@@ -66,7 +66,7 @@ static void rewrite_credential_file(const char *fn, struct credential *c,\n {\n \tint timeout_ms = 1000;\n \n-\tgit_config_get_int(\"credentialstore.locktimeoutms\", &timeout_ms);\n+\trepo_config_get_int(the_repository, \"credentialstore.locktimeoutms\", &timeout_ms);\n \tif (hold_lock_file_for_update_timeout(&credential_lock, fn, 0, timeout_ms) < 0)\n \t\tdie_errno(_(\"unable to get credential storage lock in %d ms\"), timeout_ms);\n \tif (extra)\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 607441e921b..9b0ae437148 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -3527,7 +3527,7 @@ static void git_pack_config(void)\n \t\tif (max_depth > MAX_DEPTH)\n \t\t\tmax_depth = MAX_DEPTH;\n \t}\n-\tif (!git_config_get_int(\"pack.indexversion\", &indexversion_value)) {\n+\tif (!repo_config_get_int(the_repository, \"pack.indexversion\", &indexversion_value)) {\n \t\tpack_idx_opts.version = indexversion_value;\n \t\tif (pack_idx_opts.version > 2)\n \t\t\tgit_die_config(the_repository, \"pack.indexversion\",\n@@ -3536,9 +3536,9 @@ static void git_pack_config(void)\n \tif (!git_config_get_ulong(\"pack.packsizelimit\", &packsizelimit_value))\n \t\tmax_packsize = packsizelimit_value;\n \n-\tif (!git_config_get_int(\"fastimport.unpacklimit\", &limit))\n+\tif (!repo_config_get_int(the_repository, \"fastimport.unpacklimit\", &limit))\n \t\tunpack_limit = limit;\n-\telse if (!git_config_get_int(\"transfer.unpacklimit\", &limit))\n+\telse if (!repo_config_get_int(the_repository, \"transfer.unpacklimit\", &limit))\n \t\tunpack_limit = limit;\n \n \trepo_config(the_repository, git_default_config, NULL);\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 52eae4b972d..24645c46533 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -2683,12 +2683,12 @@ int cmd_fetch(int argc,\n \t\t\t * but respect config settings disabling it.\n \t\t\t */\n \t\t\tint opt_val;\n-\t\t\tif (git_config_get_int(\"gc.autopacklimit\", &opt_val))\n+\t\t\tif (repo_config_get_int(the_repository, \"gc.autopacklimit\", &opt_val))\n \t\t\t\topt_val = -1;\n \t\t\tif (opt_val != 0)\n \t\t\t\tgit_config_push_parameter(\"gc.autoPackLimit=1\");\n \n-\t\t\tif (git_config_get_int(\"maintenance.incremental-repack.auto\", &opt_val))\n+\t\t\tif (repo_config_get_int(the_repository, \"maintenance.incremental-repack.auto\", &opt_val))\n \t\t\t\topt_val = -1;\n \t\t\tif (opt_val != 0)\n \t\t\t\tgit_config_push_parameter(\"maintenance.incremental-repack.auto=-1\");\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex a2b8fbc9f3d..cf175b8f1b7 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -189,10 +189,10 @@ static void gc_config(struct gc_config *cfg)\n \t    gc_config_is_timestamp_never(\"gc.reflogexpireunreachable\"))\n \t\tcfg->prune_reflogs = 0;\n \n-\tgit_config_get_int(\"gc.aggressivewindow\", &cfg->aggressive_window);\n-\tgit_config_get_int(\"gc.aggressivedepth\", &cfg->aggressive_depth);\n-\tgit_config_get_int(\"gc.auto\", &cfg->gc_auto_threshold);\n-\tgit_config_get_int(\"gc.autopacklimit\", &cfg->gc_auto_pack_limit);\n+\trepo_config_get_int(the_repository, \"gc.aggressivewindow\", &cfg->aggressive_window);\n+\trepo_config_get_int(the_repository, \"gc.aggressivedepth\", &cfg->aggressive_depth);\n+\trepo_config_get_int(the_repository, \"gc.auto\", &cfg->gc_auto_threshold);\n+\trepo_config_get_int(the_repository, \"gc.autopacklimit\", &cfg->gc_auto_pack_limit);\n \tgit_config_get_bool(\"gc.autodetach\", &cfg->detach_auto);\n \tgit_config_get_bool(\"gc.cruftpacks\", &cfg->cruft_packs);\n \tgit_config_get_ulong(\"gc.maxcruftsize\", &cfg->max_cruft_size);\n@@ -332,7 +332,7 @@ static int reflog_expire_condition(struct gc_config *cfg UNUSED)\n \t};\n \tint limit = 100;\n \n-\tgit_config_get_int(\"maintenance.reflog-expire.auto\", &limit);\n+\trepo_config_get_int(the_repository, \"maintenance.reflog-expire.auto\", &limit);\n \tif (!limit)\n \t\treturn 0;\n \tif (limit < 0)\n@@ -378,7 +378,7 @@ static int worktree_prune_condition(struct gc_config *cfg)\n \tstruct dirent *d;\n \tDIR *dir = NULL;\n \n-\tgit_config_get_int(\"maintenance.worktree-prune.auto\", &limit);\n+\trepo_config_get_int(the_repository, \"maintenance.worktree-prune.auto\", &limit);\n \tif (limit <= 0) {\n \t\tshould_prune = limit < 0;\n \t\tgoto out;\n@@ -423,7 +423,7 @@ static int rerere_gc_condition(struct gc_config *cfg UNUSED)\n \tint should_gc = 0, limit = 1;\n \tDIR *dir = NULL;\n \n-\tgit_config_get_int(\"maintenance.rerere-gc.auto\", &limit);\n+\trepo_config_get_int(the_repository, \"maintenance.rerere-gc.auto\", &limit);\n \tif (limit <= 0) {\n \t\tshould_gc = limit < 0;\n \t\tgoto out;\n@@ -1161,8 +1161,8 @@ static int should_write_commit_graph(struct gc_config *cfg UNUSED)\n \n \tdata.num_not_in_graph = 0;\n \tdata.limit = 100;\n-\tgit_config_get_int(\"maintenance.commit-graph.auto\",\n-\t\t\t   &data.limit);\n+\trepo_config_get_int(the_repository, \"maintenance.commit-graph.auto\",\n+\t\t\t    &data.limit);\n \n \tif (!data.limit)\n \t\treturn 0;\n@@ -1300,8 +1300,8 @@ static int loose_object_auto_condition(struct gc_config *cfg UNUSED)\n {\n \tint count = 0;\n \n-\tgit_config_get_int(\"maintenance.loose-objects.auto\",\n-\t\t\t   &loose_object_auto_limit);\n+\trepo_config_get_int(the_repository, \"maintenance.loose-objects.auto\",\n+\t\t\t    &loose_object_auto_limit);\n \n \tif (!loose_object_auto_limit)\n \t\treturn 0;\n@@ -1415,8 +1415,8 @@ static int incremental_repack_auto_condition(struct gc_config *cfg UNUSED)\n \tif (!the_repository->settings.core_multi_pack_index)\n \t\treturn 0;\n \n-\tgit_config_get_int(\"maintenance.incremental-repack.auto\",\n-\t\t\t   &incremental_repack_auto_limit);\n+\trepo_config_get_int(the_repository, \"maintenance.incremental-repack.auto\",\n+\t\t\t    &incremental_repack_auto_limit);\n \n \tif (!incremental_repack_auto_limit)\n \t\treturn 0;\ndiff --git a/config.h b/config.h\nindex 89739bee9b0..2490c47daaf 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_int(const char *key, int *dest)\n-{\n-\treturn repo_config_get_int(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_ulong(const char *key, unsigned long *dest)\n {\n \treturn repo_config_get_ulong(the_repository, key, dest);\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 04768087879..1f184efb3c9 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1901,8 +1901,8 @@ static int fetch_pack_config_cb(const char *var, const char *value,\n \n static void fetch_pack_config(void)\n {\n-\tgit_config_get_int(\"fetch.unpacklimit\", &fetch_unpack_limit);\n-\tgit_config_get_int(\"transfer.unpacklimit\", &transfer_unpack_limit);\n+\trepo_config_get_int(the_repository, \"fetch.unpacklimit\", &fetch_unpack_limit);\n+\trepo_config_get_int(the_repository, \"transfer.unpacklimit\", &transfer_unpack_limit);\n \tgit_config_get_bool(\"repack.usedeltabaseoffset\", &prefer_ofs_delta);\n \tgit_config_get_bool(\"fetch.fsckobjects\", &fetch_fsck_objects);\n \tgit_config_get_bool(\"transfer.fsckobjects\", &transfer_fsck_objects);\ndiff --git a/fsmonitor.c b/fsmonitor.c\nindex 98b2b476f08..d07dc18967a 100644\n--- a/fsmonitor.c\n+++ b/fsmonitor.c\n@@ -43,7 +43,7 @@ static int fsmonitor_hook_version(void)\n {\n \tint hook_version;\n \n-\tif (git_config_get_int(\"core.fsmonitorhookversion\", &hook_version))\n+\tif (repo_config_get_int(the_repository, \"core.fsmonitorhookversion\", &hook_version))\n \t\treturn -1;\n \n \tif (hook_version == HOOK_INTERFACE_VERSION1 ||\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 29789579c9b..45fd41f8dfd 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -5353,9 +5353,9 @@ static void merge_recursive_config(struct merge_options *opt, int ui)\n {\n \tchar *value = NULL;\n \tint renormalize = 0;\n-\tgit_config_get_int(\"merge.verbosity\", &opt->verbosity);\n-\tgit_config_get_int(\"diff.renamelimit\", &opt->rename_limit);\n-\tgit_config_get_int(\"merge.renamelimit\", &opt->rename_limit);\n+\trepo_config_get_int(the_repository, \"merge.verbosity\", &opt->verbosity);\n+\trepo_config_get_int(the_repository, \"diff.renamelimit\", &opt->rename_limit);\n+\trepo_config_get_int(the_repository, \"merge.renamelimit\", &opt->rename_limit);\n \tgit_config_get_bool(\"merge.renormalize\", &renormalize);\n \topt->renormalize = renormalize;\n \tif (!repo_config_get_string(the_repository, \"diff.renames\", &value)) {\ndiff --git a/parallel-checkout.c b/parallel-checkout.c\nindex 57c2dcaa8f6..fba6aa65a6e 100644\n--- a/parallel-checkout.c\n+++ b/parallel-checkout.c\n@@ -57,12 +57,12 @@ void get_parallel_checkout_configs(int *num_workers, int *threshold)\n \t\treturn;\n \t}\n \n-\tif (git_config_get_int(\"checkout.workers\", num_workers))\n+\tif (repo_config_get_int(the_repository, \"checkout.workers\", num_workers))\n \t\t*num_workers = DEFAULT_NUM_WORKERS;\n \telse if (*num_workers < 1)\n \t\t*num_workers = online_cpus();\n \n-\tif (git_config_get_int(\"checkout.thresholdForParallelism\", threshold))\n+\tif (repo_config_get_int(the_repository, \"checkout.thresholdForParallelism\", threshold))\n \t\t*threshold = DEFAULT_THRESHOLD_FOR_PARALLELISM;\n }\n \ndiff --git a/refs.c b/refs.c\nindex 73913b6627b..777cbd34ebc 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -945,7 +945,7 @@ long get_files_ref_lock_timeout_ms(void)\n \tstatic int timeout_ms = 100;\n \n \tif (!configured) {\n-\t\tgit_config_get_int(\"core.filesreflocktimeout\", &timeout_ms);\n+\t\trepo_config_get_int(the_repository, \"core.filesreflocktimeout\", &timeout_ms);\n \t\tconfigured = 1;\n \t}\n \ndiff --git a/refs/packed-backend.c b/refs/packed-backend.c\nindex 7fd73a0e6da..7dd26726b1e 100644\n--- a/refs/packed-backend.c\n+++ b/refs/packed-backend.c\n@@ -1228,7 +1228,7 @@ int packed_refs_lock(struct ref_store *ref_store, int flags, struct strbuf *err)\n \tstatic int timeout_value = 1000;\n \n \tif (!timeout_configured) {\n-\t\tgit_config_get_int(\"core.packedrefstimeout\", &timeout_value);\n+\t\trepo_config_get_int(the_repository, \"core.packedrefstimeout\", &timeout_value);\n \t\ttimeout_configured = 1;\n \t}\n \ndiff --git a/sequencer.c b/sequencer.c\nindex f3bada39b40..f8d9bb69df8 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -5834,7 +5834,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,\n \t\t*cmd_reset = abbr ? \"t\" : \"reset\",\n \t\t*cmd_merge = abbr ? \"m\" : \"merge\";\n \n-\tgit_config_get_int(\"rebase.maxlabellength\", &state.max_label_length);\n+\trepo_config_get_int(the_repository, \"rebase.maxlabellength\", &state.max_label_length);\n \n \toidmap_init(&commit2todo, 0);\n \toidmap_init(&state.commit2label, 0);\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 30e70f1a6c2..ce1e3330516 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -155,7 +155,7 @@ int cmd__config(int argc, const char **argv)\n \t\t\tBUG(\"Key \\\"%s\\\" has unknown return %d\", argv[2], ret);\n \t\tgoto exit1;\n \t} else if (argc == 3 && !strcmp(argv[1], \"get_int\")) {\n-\t\tif (!git_config_get_int(argv[2], &val)) {\n+\t\tif (!repo_config_get_int(the_repository, argv[2], &val)) {\n \t\t\tprintf(\"%d\\n\", val);\n \t\t\tgoto exit0;\n \t\t} else {\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522193","messageId":"20250717-pks-config-wo-the-repository-v1-10-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 10/21] config: drop `git_config_get_ulong()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:30Z","receivedAt":"2025-07-17T10:50:03Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_ulong()`. All\ncallsites are adjusted so that they use\n`repo_config_get_ulong(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/fast-import.c |  4 ++--\n builtin/gc.c          | 10 +++++-----\n config.h              |  5 -----\n http-backend.c        |  2 +-\n 4 files changed, 8 insertions(+), 13 deletions(-)\n\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 9b0ae437148..a3f7f14f4fe 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -3523,7 +3523,7 @@ static void git_pack_config(void)\n \tint limit;\n \tunsigned long packsizelimit_value;\n \n-\tif (!git_config_get_ulong(\"pack.depth\", &max_depth)) {\n+\tif (!repo_config_get_ulong(the_repository, \"pack.depth\", &max_depth)) {\n \t\tif (max_depth > MAX_DEPTH)\n \t\t\tmax_depth = MAX_DEPTH;\n \t}\n@@ -3533,7 +3533,7 @@ static void git_pack_config(void)\n \t\t\tgit_die_config(the_repository, \"pack.indexversion\",\n \t\t\t\t       \"bad pack.indexVersion=%\"PRIu32, pack_idx_opts.version);\n \t}\n-\tif (!git_config_get_ulong(\"pack.packsizelimit\", &packsizelimit_value))\n+\tif (!repo_config_get_ulong(the_repository, \"pack.packsizelimit\", &packsizelimit_value))\n \t\tmax_packsize = packsizelimit_value;\n \n \tif (!repo_config_get_int(the_repository, \"fastimport.unpacklimit\", &limit))\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex cf175b8f1b7..d15daf59625 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -195,7 +195,7 @@ static void gc_config(struct gc_config *cfg)\n \trepo_config_get_int(the_repository, \"gc.autopacklimit\", &cfg->gc_auto_pack_limit);\n \tgit_config_get_bool(\"gc.autodetach\", &cfg->detach_auto);\n \tgit_config_get_bool(\"gc.cruftpacks\", &cfg->cruft_packs);\n-\tgit_config_get_ulong(\"gc.maxcruftsize\", &cfg->max_cruft_size);\n+\trepo_config_get_ulong(the_repository, \"gc.maxcruftsize\", &cfg->max_cruft_size);\n \n \tif (!repo_config_get_expiry(the_repository, \"gc.pruneexpire\", &owned)) {\n \t\tfree(cfg->prune_expire);\n@@ -212,10 +212,10 @@ static void gc_config(struct gc_config *cfg)\n \t\tcfg->gc_log_expire = owned;\n \t}\n \n-\tgit_config_get_ulong(\"gc.bigpackthreshold\", &cfg->big_pack_threshold);\n-\tgit_config_get_ulong(\"pack.deltacachesize\", &cfg->max_delta_cache_size);\n+\trepo_config_get_ulong(the_repository, \"gc.bigpackthreshold\", &cfg->big_pack_threshold);\n+\trepo_config_get_ulong(the_repository, \"pack.deltacachesize\", &cfg->max_delta_cache_size);\n \n-\tif (!git_config_get_ulong(\"core.deltabasecachelimit\", &ulongval))\n+\tif (!repo_config_get_ulong(the_repository, \"core.deltabasecachelimit\", &ulongval))\n \t\tcfg->delta_base_cache_limit = ulongval;\n \n \tif (!repo_config_get_string(the_repository, \"gc.repackfilter\", &owned)) {\n@@ -2344,7 +2344,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit\n \t\tdie(_(\"failed to create directories for '%s'\"), filename);\n \n \tif ((long)lock_file_timeout_ms < 0 &&\n-\t    git_config_get_ulong(\"gc.launchctlplistlocktimeoutms\",\n+\t    repo_config_get_ulong(the_repository, \"gc.launchctlplistlocktimeoutms\",\n \t\t\t\t &lock_file_timeout_ms))\n \t\tlock_file_timeout_ms = 150;\n \ndiff --git a/config.h b/config.h\nindex 2490c47daaf..e22c07a4488 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_ulong(const char *key, unsigned long *dest)\n-{\n-\treturn repo_config_get_ulong(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_bool(const char *key, int *dest)\n {\n \treturn repo_config_get_bool(the_repository, key, dest);\ndiff --git a/http-backend.c b/http-backend.c\nindex ad8c4037493..3d5d5a84646 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -247,7 +247,7 @@ static void http_config(void)\n \tstruct strbuf var = STRBUF_INIT;\n \n \tgit_config_get_bool(\"http.getanyfile\", &getanyfile);\n-\tgit_config_get_ulong(\"http.maxrequestbuffer\", &max_request_buffer);\n+\trepo_config_get_ulong(the_repository, \"http.maxrequestbuffer\", &max_request_buffer);\n \n \tfor (i = 0; i < ARRAY_SIZE(rpc_service); i++) {\n \t\tstruct rpc_service *svc = &rpc_service[i];\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522194","messageId":"20250717-pks-config-wo-the-repository-v1-11-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 11/21] config: drop `git_config_get_bool()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:31Z","receivedAt":"2025-07-17T10:50:05Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_bool()`. All\ncallsites are adjusted so that they use\n`repo_config_get_bool(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n archive.c                          | 2 +-\n builtin/am.c                       | 8 ++++----\n builtin/checkout.c                 | 2 +-\n builtin/clone.c                    | 2 +-\n builtin/credential-cache--daemon.c | 2 +-\n builtin/gc.c                       | 6 +++---\n builtin/grep.c                     | 2 +-\n builtin/rebase.c                   | 2 +-\n compat/precompose_utf8.c           | 2 +-\n config.h                           | 5 -----\n daemon.c                           | 2 +-\n fetch-pack.c                       | 8 ++++----\n http-backend.c                     | 4 ++--\n merge-ort.c                        | 2 +-\n promisor-remote.c                  | 4 ++--\n read-cache.c                       | 4 ++--\n rerere.c                           | 4 ++--\n run-command.c                      | 6 +++---\n setup.c                            | 2 +-\n t/helper/test-config.c             | 2 +-\n transport.c                        | 2 +-\n 21 files changed, 34 insertions(+), 39 deletions(-)\n\ndiff --git a/archive.c b/archive.c\nindex 2dd306a07a7..310672b479a 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -760,7 +760,7 @@ int write_archive(int argc, const char **argv, const char *prefix,\n \tconst char **argv_copy;\n \tint rc;\n \n-\tgit_config_get_bool(\"uploadarchive.allowunreachable\", &remote_allow_unreachable);\n+\trepo_config_get_bool(the_repository, \"uploadarchive.allowunreachable\", &remote_allow_unreachable);\n \trepo_config(the_repository, git_default_config, NULL);\n \n \tdescribe_status.max_invocations = 1;\ndiff --git a/builtin/am.c b/builtin/am.c\nindex a7e7cf1465a..6073d64ae97 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -162,18 +162,18 @@ static void am_state_init(struct am_state *state)\n \n \tstate->prec = 4;\n \n-\tgit_config_get_bool(\"am.threeway\", &state->threeway);\n+\trepo_config_get_bool(the_repository, \"am.threeway\", &state->threeway);\n \n \tstate->utf8 = 1;\n \n-\tgit_config_get_bool(\"am.messageid\", &state->message_id);\n+\trepo_config_get_bool(the_repository, \"am.messageid\", &state->message_id);\n \n \tstate->scissors = SCISSORS_UNSET;\n \tstate->quoted_cr = quoted_cr_unset;\n \n \tstrvec_init(&state->git_apply_opts);\n \n-\tif (!git_config_get_bool(\"commit.gpgsign\", &gpgsign))\n+\tif (!repo_config_get_bool(the_repository, \"commit.gpgsign\", &gpgsign))\n \t\tstate->sign_commit = gpgsign ? \"\" : NULL;\n }\n \n@@ -965,7 +965,7 @@ static int split_mail(struct am_state *state, enum patch_format patch_format,\n {\n \tif (keep_cr < 0) {\n \t\tkeep_cr = 0;\n-\t\tgit_config_get_bool(\"am.keepcr\", &keep_cr);\n+\t\trepo_config_get_bool(the_repository, \"am.keepcr\", &keep_cr);\n \t}\n \n \tswitch (patch_format) {\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 948ff7bdda7..37efde59898 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -291,7 +291,7 @@ static int checkout_merged(int pos, const struct checkout *state,\n \tread_mmblob(&ours, &threeway[1]);\n \tread_mmblob(&theirs, &threeway[2]);\n \n-\tgit_config_get_bool(\"merge.renormalize\", &renormalize);\n+\trepo_config_get_bool(the_repository, \"merge.renormalize\", &renormalize);\n \tll_opts.renormalize = renormalize;\n \tll_opts.conflict_style = conflict_style;\n \tmerge_status = ll_merge(&result_buf, path, &ancestor, \"base\",\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 3c6d8529b6c..34eea11db4d 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -1150,7 +1150,7 @@ int cmd_clone(int argc,\n \t\t\tstrbuf_reset(&sb);\n \t\t}\n \n-\t\tif (!git_config_get_bool(\"submodule.stickyRecursiveClone\", &val) &&\n+\t\tif (!repo_config_get_bool(the_repository, \"submodule.stickyRecursiveClone\", &val) &&\n \t\t    val)\n \t\t\tstring_list_append(&option_config, \"submodule.recurse=true\");\n \ndiff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c\nindex 5065ff4660b..65cc619bec2 100644\n--- a/builtin/credential-cache--daemon.c\n+++ b/builtin/credential-cache--daemon.c\n@@ -307,7 +307,7 @@ int cmd_credential_cache_daemon(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config_get_bool(\"credentialcache.ignoresighup\", &ignore_sighup);\n+\trepo_config_get_bool(the_repository, \"credentialcache.ignoresighup\", &ignore_sighup);\n \n \targc = parse_options(argc, argv, prefix, options, usage, 0);\n \tsocket_path = argv[0];\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex d15daf59625..fa62e4f2627 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -193,8 +193,8 @@ static void gc_config(struct gc_config *cfg)\n \trepo_config_get_int(the_repository, \"gc.aggressivedepth\", &cfg->aggressive_depth);\n \trepo_config_get_int(the_repository, \"gc.auto\", &cfg->gc_auto_threshold);\n \trepo_config_get_int(the_repository, \"gc.autopacklimit\", &cfg->gc_auto_pack_limit);\n-\tgit_config_get_bool(\"gc.autodetach\", &cfg->detach_auto);\n-\tgit_config_get_bool(\"gc.cruftpacks\", &cfg->cruft_packs);\n+\trepo_config_get_bool(the_repository, \"gc.autodetach\", &cfg->detach_auto);\n+\trepo_config_get_bool(the_repository, \"gc.cruftpacks\", &cfg->cruft_packs);\n \trepo_config_get_ulong(the_repository, \"gc.maxcruftsize\", &cfg->max_cruft_size);\n \n \tif (!repo_config_get_expiry(the_repository, \"gc.pruneexpire\", &owned)) {\n@@ -1779,7 +1779,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,\n \t\tstrbuf_reset(&config_name);\n \t\tstrbuf_addf(&config_name, \"maintenance.%s.enabled\",\n \t\t\t    tasks[i].name);\n-\t\tif (!git_config_get_bool(config_name.buf, &config_value))\n+\t\tif (!repo_config_get_bool(the_repository, config_name.buf, &config_value))\n \t\t\tstrategy.tasks[i].enabled = config_value;\n \t\tif (!strategy.tasks[i].enabled)\n \t\t\tcontinue;\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 7982dda9a3b..8fcb69dbf2c 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -1058,7 +1058,7 @@ int cmd_grep(int argc,\n \n \tif (use_index && !startup_info->have_repository) {\n \t\tint fallback = 0;\n-\t\tgit_config_get_bool(\"grep.fallbacktonoindex\", &fallback);\n+\t\trepo_config_get_bool(the_repository, \"grep.fallbacktonoindex\", &fallback);\n \t\tif (fallback)\n \t\t\tuse_index = 0;\n \t\telse\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 0c3daa4b814..72a52bdfb98 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -340,7 +340,7 @@ static int run_sequencer_rebase(struct rebase_options *opts)\n \tunsigned flags = 0;\n \tint abbreviate_commands = 0, ret = 0;\n \n-\tgit_config_get_bool(\"rebase.abbreviatecommands\", &abbreviate_commands);\n+\trepo_config_get_bool(the_repository, \"rebase.abbreviatecommands\", &abbreviate_commands);\n \n \tflags |= opts->keep_empty ? TODO_LIST_KEEP_EMPTY : 0;\n \tflags |= abbreviate_commands ? TODO_LIST_ABBREVIATE_CMDS : 0;\ndiff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c\nindex 12e38e0ea3c..3985ed108eb 100644\n--- a/compat/precompose_utf8.c\n+++ b/compat/precompose_utf8.c\n@@ -75,7 +75,7 @@ const char *precompose_string_if_needed(const char *in)\n \t\ticonv_t ic_prec;\n \t\tchar *out;\n \t\tif (precomposed_unicode < 0)\n-\t\t\tgit_config_get_bool(\"core.precomposeunicode\", &precomposed_unicode);\n+\t\t\trepo_config_get_bool(the_repository, \"core.precomposeunicode\", &precomposed_unicode);\n \t\tif (precomposed_unicode != 1)\n \t\t\treturn in;\n \t\tic_prec = iconv_open(repo_encoding, path_encoding);\ndiff --git a/config.h b/config.h\nindex e22c07a4488..c9f582c7c55 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_bool(const char *key, int *dest)\n-{\n-\treturn repo_config_get_bool(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest)\n {\n \treturn repo_config_get_bool_or_int(the_repository, key, is_bool, dest);\ndiff --git a/daemon.c b/daemon.c\nindex 61cd50f7200..cb209235557 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -402,7 +402,7 @@ static int run_service(const char *dir, struct daemon_service *service,\n \n \tif (service->overridable) {\n \t\tstrbuf_addf(&var, \"daemon.%s\", service->config_name);\n-\t\tgit_config_get_bool(var.buf, &enabled);\n+\t\trepo_config_get_bool(the_repository, var.buf, &enabled);\n \t\tstrbuf_release(&var);\n \t}\n \tif (!enabled) {\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 1f184efb3c9..94b1436c5c2 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1903,10 +1903,10 @@ static void fetch_pack_config(void)\n {\n \trepo_config_get_int(the_repository, \"fetch.unpacklimit\", &fetch_unpack_limit);\n \trepo_config_get_int(the_repository, \"transfer.unpacklimit\", &transfer_unpack_limit);\n-\tgit_config_get_bool(\"repack.usedeltabaseoffset\", &prefer_ofs_delta);\n-\tgit_config_get_bool(\"fetch.fsckobjects\", &fetch_fsck_objects);\n-\tgit_config_get_bool(\"transfer.fsckobjects\", &transfer_fsck_objects);\n-\tgit_config_get_bool(\"transfer.advertisesid\", &advertise_sid);\n+\trepo_config_get_bool(the_repository, \"repack.usedeltabaseoffset\", &prefer_ofs_delta);\n+\trepo_config_get_bool(the_repository, \"fetch.fsckobjects\", &fetch_fsck_objects);\n+\trepo_config_get_bool(the_repository, \"transfer.fsckobjects\", &transfer_fsck_objects);\n+\trepo_config_get_bool(the_repository, \"transfer.advertisesid\", &advertise_sid);\n \tif (!uri_protocols.nr) {\n \t\tchar *str;\n \ndiff --git a/http-backend.c b/http-backend.c\nindex 3d5d5a84646..d5dfe762bb5 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -246,13 +246,13 @@ static void http_config(void)\n \tint i, value = 0;\n \tstruct strbuf var = STRBUF_INIT;\n \n-\tgit_config_get_bool(\"http.getanyfile\", &getanyfile);\n+\trepo_config_get_bool(the_repository, \"http.getanyfile\", &getanyfile);\n \trepo_config_get_ulong(the_repository, \"http.maxrequestbuffer\", &max_request_buffer);\n \n \tfor (i = 0; i < ARRAY_SIZE(rpc_service); i++) {\n \t\tstruct rpc_service *svc = &rpc_service[i];\n \t\tstrbuf_addf(&var, \"http.%s\", svc->config_name);\n-\t\tif (!git_config_get_bool(var.buf, &value))\n+\t\tif (!repo_config_get_bool(the_repository, var.buf, &value))\n \t\t\tsvc->enabled = value;\n \t\tstrbuf_reset(&var);\n \t}\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 45fd41f8dfd..86896ff11b0 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -5356,7 +5356,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)\n \trepo_config_get_int(the_repository, \"merge.verbosity\", &opt->verbosity);\n \trepo_config_get_int(the_repository, \"diff.renamelimit\", &opt->rename_limit);\n \trepo_config_get_int(the_repository, \"merge.renamelimit\", &opt->rename_limit);\n-\tgit_config_get_bool(\"merge.renormalize\", &renormalize);\n+\trepo_config_get_bool(the_repository, \"merge.renormalize\", &renormalize);\n \topt->renormalize = renormalize;\n \tif (!repo_config_get_string(the_repository, \"diff.renames\", &value)) {\n \t\topt->detect_renames = git_config_rename(\"diff.renames\", value);\ndiff --git a/promisor-remote.c b/promisor-remote.c\nindex a9c877d9cfa..08b0da89622 100644\n--- a/promisor-remote.c\n+++ b/promisor-remote.c\n@@ -46,7 +46,7 @@ static int fetch_objects(struct repository *repo,\n \t\t     \"fetch\", remote_name, \"--no-tags\",\n \t\t     \"--no-write-fetch-head\", \"--recurse-submodules=no\",\n \t\t     \"--filter=blob:none\", \"--stdin\", NULL);\n-\tif (!git_config_get_bool(\"promisor.quiet\", &quiet) && quiet)\n+\tif (!repo_config_get_bool(the_repository, \"promisor.quiet\", &quiet) && quiet)\n \t\tstrvec_push(&child.args, \"--quiet\");\n \tif (start_command(&child))\n \t\tdie(_(\"promisor-remote: unable to fork off fetch subprocess\"));\n@@ -343,7 +343,7 @@ char *promisor_remote_info(struct repository *repo)\n \tstruct strvec names = STRVEC_INIT;\n \tstruct strvec urls = STRVEC_INIT;\n \n-\tgit_config_get_bool(\"promisor.advertise\", &advertise_promisors);\n+\trepo_config_get_bool(the_repository, \"promisor.advertise\", &advertise_promisors);\n \n \tif (!advertise_promisors)\n \t\treturn NULL;\ndiff --git a/read-cache.c b/read-cache.c\nindex 5cf41b81f1f..4fdde758d1b 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -2755,7 +2755,7 @@ static int record_eoie(void)\n {\n \tint val;\n \n-\tif (!git_config_get_bool(\"index.recordendofindexentries\", &val))\n+\tif (!repo_config_get_bool(the_repository, \"index.recordendofindexentries\", &val))\n \t\treturn val;\n \n \t/*\n@@ -2770,7 +2770,7 @@ static int record_ieot(void)\n {\n \tint val;\n \n-\tif (!git_config_get_bool(\"index.recordoffsettable\", &val))\n+\tif (!repo_config_get_bool(the_repository, \"index.recordoffsettable\", &val))\n \t\treturn val;\n \n \t/*\ndiff --git a/rerere.c b/rerere.c\nindex 1ac2075144c..c7c3e535ce5 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -877,8 +877,8 @@ static int do_plain_rerere(struct repository *r,\n \n static void git_rerere_config(void)\n {\n-\tgit_config_get_bool(\"rerere.enabled\", &rerere_enabled);\n-\tgit_config_get_bool(\"rerere.autoupdate\", &rerere_autoupdate);\n+\trepo_config_get_bool(the_repository, \"rerere.enabled\", &rerere_enabled);\n+\trepo_config_get_bool(the_repository, \"rerere.autoupdate\", &rerere_autoupdate);\n \trepo_config(the_repository, git_default_config, NULL);\n }\n \ndiff --git a/run-command.c b/run-command.c\nindex 8833b233678..ed9575bd6a8 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -1817,7 +1817,7 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint)\n {\n \tint enabled, auto_detach;\n \n-\tif (!git_config_get_bool(\"maintenance.auto\", &enabled) &&\n+\tif (!repo_config_get_bool(the_repository, \"maintenance.auto\", &enabled) &&\n \t    !enabled)\n \t\treturn 0;\n \n@@ -1826,8 +1826,8 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint)\n \t * honoring `gc.autoDetach`. This is somewhat weird, but required to\n \t * retain behaviour from when we used to run git-gc(1) here.\n \t */\n-\tif (git_config_get_bool(\"maintenance.autodetach\", &auto_detach) &&\n-\t    git_config_get_bool(\"gc.autodetach\", &auto_detach))\n+\tif (repo_config_get_bool(the_repository, \"maintenance.autodetach\", &auto_detach) &&\n+\t    repo_config_get_bool(the_repository, \"gc.autodetach\", &auto_detach))\n \t\tauto_detach = 1;\n \n \tmaint->git_cmd = 1;\ndiff --git a/setup.c b/setup.c\nindex 9661c5d5d5d..a06bb921b3a 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1877,7 +1877,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t * the core.precomposeunicode configuration, this\n \t * has to happen after the above block that finds\n \t * out where the repository is, i.e. a preparation\n-\t * for calling git_config_get_bool().\n+\t * for calling repo_config_get_bool().\n \t */\n \tif (prefix) {\n \t\tprefix = precompose_string_if_needed(prefix);\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex ce1e3330516..9f8cca7c48c 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -163,7 +163,7 @@ int cmd__config(int argc, const char **argv)\n \t\t\tgoto exit1;\n \t\t}\n \t} else if (argc == 3 && !strcmp(argv[1], \"get_bool\")) {\n-\t\tif (!git_config_get_bool(argv[2], &val)) {\n+\t\tif (!repo_config_get_bool(the_repository, argv[2], &val)) {\n \t\t\tprintf(\"%d\\n\", val);\n \t\t\tgoto exit0;\n \t\t} else {\ndiff --git a/transport.c b/transport.c\nindex 89e6297ce22..e305d6bd228 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -1602,7 +1602,7 @@ int transport_get_remote_bundle_uri(struct transport *transport)\n \t * Don't request bundle-uri from the server unless configured to\n \t * do so by the transfer.bundleURI=true config option.\n \t */\n-\tif (git_config_get_bool(\"transfer.bundleuri\", &value) || !value)\n+\tif (repo_config_get_bool(the_repository, \"transfer.bundleuri\", &value) || !value)\n \t\treturn 0;\n \n \tif (!transport->bundles->baseURI)\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522195","messageId":"20250717-pks-config-wo-the-repository-v1-12-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 12/21] config: drop `git_config_set_in_file()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:32Z","receivedAt":"2025-07-17T10:50:09Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_set_in_file()`.\nAll callsites are adjusted so that they use\n`repo_config_set_in_file(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/submodule--helper.c | 10 +++++-----\n config.h                    |  6 ------\n dir.c                       |  4 ++--\n 3 files changed, 7 insertions(+), 13 deletions(-)\n\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex d2ab31835b5..0be737ac4ff 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1810,12 +1810,12 @@ static int clone_submodule(const struct module_clone_data *clone_data,\n \t/* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */\n \trepo_config_get_string(the_repository, \"submodule.alternateLocation\", &sm_alternate);\n \tif (sm_alternate)\n-\t\tgit_config_set_in_file(p, \"submodule.alternateLocation\",\n-\t\t\t\t       sm_alternate);\n+\t\trepo_config_set_in_file(the_repository, p, \"submodule.alternateLocation\",\n+\t\t\t\t\tsm_alternate);\n \trepo_config_get_string(the_repository, \"submodule.alternateErrorStrategy\", &error_strategy);\n \tif (error_strategy)\n-\t\tgit_config_set_in_file(p, \"submodule.alternateErrorStrategy\",\n-\t\t\t\t       error_strategy);\n+\t\trepo_config_set_in_file(the_repository, p, \"submodule.alternateErrorStrategy\",\n+\t\t\t\t\terror_strategy);\n \n \tfree(sm_alternate);\n \tfree(error_strategy);\n@@ -2522,7 +2522,7 @@ static int ensure_core_worktree(const char *path)\n \t\tabs_path = absolute_pathdup(path);\n \t\trel_path = relative_path(abs_path, subrepo.gitdir, &sb);\n \n-\t\tgit_config_set_in_file(cfg_file, \"core.worktree\", rel_path);\n+\t\trepo_config_set_in_file(the_repository, cfg_file, \"core.worktree\", rel_path);\n \n \t\tfree(cfg_file);\n \t\tfree(abs_path);\ndiff --git a/config.h b/config.h\nindex c9f582c7c55..b4f79d4d4cc 100644\n--- a/config.h\n+++ b/config.h\n@@ -734,12 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)\n \treturn repo_config_get_pathname(the_repository, key, dest);\n }\n \n-static inline void git_config_set_in_file(const char *config_filename,\n-\t\t\t\t\t  const char *key, const char *value)\n-{\n-\trepo_config_set_in_file(the_repository, config_filename, key, value);\n-}\n-\n static inline int git_config_set_gently(const char *key, const char *value)\n {\n \treturn repo_config_set_gently(the_repository, key, value);\ndiff --git a/dir.c b/dir.c\nindex 02873f59ea6..dfb4d40103f 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -4091,8 +4091,8 @@ void connect_work_tree_and_git_dir(const char *work_tree_,\n \twrite_file(gitfile_sb.buf, \"gitdir: %s\",\n \t\t   relative_path(git_dir, work_tree, &rel_path));\n \t/* Update core.worktree setting */\n-\tgit_config_set_in_file(cfg_sb.buf, \"core.worktree\",\n-\t\t\t       relative_path(work_tree, git_dir, &rel_path));\n+\trepo_config_set_in_file(the_repository, cfg_sb.buf, \"core.worktree\",\n+\t\t\t\trelative_path(work_tree, git_dir, &rel_path));\n \n \tstrbuf_release(&gitfile_sb);\n \tstrbuf_release(&cfg_sb);\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522196","messageId":"20250717-pks-config-wo-the-repository-v1-13-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 13/21] config: drop `git_config_set_gently()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:33Z","receivedAt":"2025-07-17T10:50:11Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_set_gently()`.\nAll callsites are adjusted so that they use\n`repo_config_set_gently(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n branch.c                    |  6 +++---\n builtin/clone.c             |  2 +-\n builtin/remote.c            |  8 ++++----\n builtin/submodule--helper.c | 14 +++++++-------\n config.h                    |  5 -----\n scalar.c                    |  4 ++--\n setup.c                     |  4 ++--\n worktree.c                  |  4 ++--\n 8 files changed, 21 insertions(+), 26 deletions(-)\n\ndiff --git a/branch.c b/branch.c\nindex b4811671fc7..3dc237adf6c 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -116,7 +116,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,\n \t\t\t}\n \n \tstrbuf_addf(&key, \"branch.%s.remote\", local);\n-\tif (git_config_set_gently(key.buf, origin ? origin : \".\") < 0)\n+\tif (repo_config_set_gently(the_repository, key.buf, origin ? origin : \".\") < 0)\n \t\tgoto out_err;\n \n \tstrbuf_reset(&key);\n@@ -127,7 +127,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,\n \t * more than one is provided, use CONFIG_REGEX_NONE to preserve what\n \t * we've written so far.\n \t */\n-\tif (git_config_set_gently(key.buf, NULL) < 0)\n+\tif (repo_config_set_gently(the_repository, key.buf, NULL) < 0)\n \t\tgoto out_err;\n \tfor_each_string_list_item(item, remotes)\n \t\tif (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)\n@@ -136,7 +136,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,\n \tif (rebasing) {\n \t\tstrbuf_reset(&key);\n \t\tstrbuf_addf(&key, \"branch.%s.rebase\", local);\n-\t\tif (git_config_set_gently(key.buf, \"true\") < 0)\n+\t\tif (repo_config_set_gently(the_repository, key.buf, \"true\") < 0)\n \t\t\tgoto out_err;\n \t}\n \tstrbuf_release(&key);\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 34eea11db4d..0d7dd5e8ec9 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -1467,7 +1467,7 @@ int cmd_clone(int argc,\n \t\t\twarning(_(\"failed to fetch objects from bundle URI '%s'\"),\n \t\t\t\tbundle_uri);\n \t\telse if (has_heuristic)\n-\t\t\tgit_config_set_gently(\"fetch.bundleuri\", bundle_uri);\n+\t\t\trepo_config_set_gently(the_repository, \"fetch.bundleuri\", bundle_uri);\n \n \t\tremote_state_clear(the_repository->remote_state);\n \t\tfree(the_repository->remote_state);\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 826b2dcfd04..5c4dfc98afa 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -694,8 +694,8 @@ static void handle_push_default(const char* old_name, const char* new_name)\n \tif (push_default.scope >= CONFIG_SCOPE_COMMAND)\n \t\t; /* pass */\n \telse if (push_default.scope >= CONFIG_SCOPE_LOCAL) {\n-\t\tint result = git_config_set_gently(\"remote.pushDefault\",\n-\t\t\t\t\t\t   new_name);\n+\t\tint result = repo_config_set_gently(the_repository, \"remote.pushDefault\",\n+\t\t\t\t\t\t    new_name);\n \t\tif (new_name && result && result != CONFIG_NOTHING_SET)\n \t\t\tdie(_(\"could not set '%s'\"), \"remote.pushDefault\");\n \t\telse if (!new_name && result && result != CONFIG_NOTHING_SET)\n@@ -934,7 +934,7 @@ static int rm(int argc, const char **argv, const char *prefix,\n \t\t\t\tstrbuf_reset(&buf);\n \t\t\t\tstrbuf_addf(&buf, \"branch.%s.%s\",\n \t\t\t\t\t\titem->string, *k);\n-\t\t\t\tresult = git_config_set_gently(buf.buf, NULL);\n+\t\t\t\tresult = repo_config_set_gently(the_repository, buf.buf, NULL);\n \t\t\t\tif (result && result != CONFIG_NOTHING_SET)\n \t\t\t\t\tdie(_(\"could not unset '%s'\"), buf.buf);\n \t\t\t}\n@@ -942,7 +942,7 @@ static int rm(int argc, const char **argv, const char *prefix,\n \t\tif (info->push_remote_name && !strcmp(info->push_remote_name, remote->name)) {\n \t\t\tstrbuf_reset(&buf);\n \t\t\tstrbuf_addf(&buf, \"branch.%s.pushremote\", item->string);\n-\t\t\tresult = git_config_set_gently(buf.buf, NULL);\n+\t\t\tresult = repo_config_set_gently(the_repository, buf.buf, NULL);\n \t\t\tif (result && result != CONFIG_NOTHING_SET)\n \t\t\t\tdie(_(\"could not unset '%s'\"), buf.buf);\n \t\t}\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 0be737ac4ff..710a2a2004e 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -458,7 +458,7 @@ static void init_submodule(const char *path, const char *prefix,\n \t */\n \tif (!is_submodule_active(the_repository, path)) {\n \t\tstrbuf_addf(&sb, \"submodule.%s.active\", sub->name);\n-\t\tgit_config_set_gently(sb.buf, \"true\");\n+\t\trepo_config_set_gently(the_repository, sb.buf, \"true\");\n \t\tstrbuf_reset(&sb);\n \t}\n \n@@ -484,7 +484,7 @@ static void init_submodule(const char *path, const char *prefix,\n \t\t\tfree(oldurl);\n \t\t}\n \n-\t\tif (git_config_set_gently(sb.buf, url))\n+\t\tif (repo_config_set_gently(the_repository, sb.buf, url))\n \t\t\tdie(_(\"Failed to register url for submodule path '%s'\"),\n \t\t\t    displaypath);\n \t\tif (!(flags & OPT_QUIET))\n@@ -506,7 +506,7 @@ static void init_submodule(const char *path, const char *prefix,\n \t\t\tupd = submodule_update_type_to_string(sub->update_strategy.type);\n \t\t}\n \n-\t\tif (git_config_set_gently(sb.buf, upd))\n+\t\tif (repo_config_set_gently(the_repository, sb.buf, upd))\n \t\t\tdie(_(\"Failed to register update mode for submodule path '%s'\"), displaypath);\n \t}\n \tstrbuf_release(&sb);\n@@ -1262,7 +1262,7 @@ static void sync_submodule(const char *path, const char *prefix,\n \n \tstrbuf_reset(&sb);\n \tstrbuf_addf(&sb, \"submodule.%s.url\", sub->name);\n-\tif (git_config_set_gently(sb.buf, super_config_url))\n+\tif (repo_config_set_gently(the_repository, sb.buf, super_config_url))\n \t\tdie(_(\"failed to register url for submodule path '%s'\"),\n \t\t      displaypath);\n \n@@ -3309,7 +3309,7 @@ static void configure_added_submodule(struct add_data *add_data)\n \tstruct child_process add_gitmodules = CHILD_PROCESS_INIT;\n \n \tkey = xstrfmt(\"submodule.%s.url\", add_data->sm_name);\n-\tgit_config_set_gently(key, add_data->realrepo);\n+\trepo_config_set_gently(the_repository, key, add_data->realrepo);\n \tfree(key);\n \n \tadd_submod.git_cmd = 1;\n@@ -3356,12 +3356,12 @@ static void configure_added_submodule(struct add_data *add_data)\n \t\t */\n \t\tif (!is_submodule_active(the_repository, add_data->sm_path)) {\n \t\t\tkey = xstrfmt(\"submodule.%s.active\", add_data->sm_name);\n-\t\t\tgit_config_set_gently(key, \"true\");\n+\t\t\trepo_config_set_gently(the_repository, key, \"true\");\n \t\t\tfree(key);\n \t\t}\n \t} else {\n \t\tkey = xstrfmt(\"submodule.%s.active\", add_data->sm_name);\n-\t\tgit_config_set_gently(key, \"true\");\n+\t\trepo_config_set_gently(the_repository, key, \"true\");\n \t\tfree(key);\n \t}\n }\ndiff --git a/config.h b/config.h\nindex b4f79d4d4cc..90977441c3b 100644\n--- a/config.h\n+++ b/config.h\n@@ -734,11 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)\n \treturn repo_config_get_pathname(the_repository, key, dest);\n }\n \n-static inline int git_config_set_gently(const char *key, const char *value)\n-{\n-\treturn repo_config_set_gently(the_repository, key, value);\n-}\n-\n static inline void git_config_set(const char *key, const char *value)\n {\n \trepo_config_set(the_repository, key, value);\ndiff --git a/scalar.c b/scalar.c\nindex 07f855c9913..c09c5ca194e 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -103,7 +103,7 @@ static int set_scalar_config(const struct scalar_config *config, int reconfigure\n \tif ((reconfigure && config->overwrite_on_reconfigure) ||\n \t    repo_config_get_string(the_repository, config->key, &value)) {\n \t\ttrace2_data_string(\"scalar\", the_repository, config->key, \"created\");\n-\t\tres = git_config_set_gently(config->key, config->value);\n+\t\tres = repo_config_set_gently(the_repository, config->key, config->value);\n \t} else {\n \t\ttrace2_data_string(\"scalar\", the_repository, config->key, \"exists\");\n \t\tres = 0;\n@@ -322,7 +322,7 @@ static int set_config(const char *fmt, ...)\n \tvalue = strchr(buf.buf, '=');\n \tif (value)\n \t\t*(value++) = '\\0';\n-\tres = git_config_set_gently(buf.buf, value);\n+\tres = repo_config_set_gently(the_repository, buf.buf, value);\n \tstrbuf_release(&buf);\n \n \treturn res;\ndiff --git a/setup.c b/setup.c\nindex a06bb921b3a..a05c348dcdf 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -2236,13 +2236,13 @@ void initialize_repository_version(int hash_algo,\n \t\tgit_config_set(\"extensions.objectformat\",\n \t\t\t       hash_algos[hash_algo].name);\n \telse if (reinit)\n-\t\tgit_config_set_gently(\"extensions.objectformat\", NULL);\n+\t\trepo_config_set_gently(the_repository, \"extensions.objectformat\", NULL);\n \n \tif (ref_storage_format != REF_STORAGE_FORMAT_FILES)\n \t\tgit_config_set(\"extensions.refstorage\",\n \t\t\t       ref_storage_format_to_name(ref_storage_format));\n \telse if (reinit)\n-\t\tgit_config_set_gently(\"extensions.refstorage\", NULL);\n+\t\trepo_config_set_gently(the_repository, \"extensions.refstorage\", NULL);\n \n \tif (reinit) {\n \t\tstruct strbuf config = STRBUF_INIT;\ndiff --git a/worktree.c b/worktree.c\nindex c34b9eb74e5..981a2713374 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -1013,7 +1013,7 @@ int init_worktree_config(struct repository *r)\n \t */\n \tif (r->repository_format_worktree_config)\n \t\treturn 0;\n-\tif ((res = git_config_set_gently(\"extensions.worktreeConfig\", \"true\")))\n+\tif ((res = repo_config_set_gently(the_repository, \"extensions.worktreeConfig\", \"true\")))\n \t\treturn error(_(\"failed to set extensions.worktreeConfig setting\"));\n \n \tcommon_config_file = xstrfmt(\"%s/config\", r->commondir);\n@@ -1077,7 +1077,7 @@ void write_worktree_linking_files(struct strbuf dotgit, struct strbuf gitdir,\n \tif (use_relative_paths && !the_repository->repository_format_relative_worktrees) {\n \t\tif (upgrade_repository_format(1) < 0)\n \t\t\tdie(_(\"unable to upgrade repository format to support relative worktrees\"));\n-\t\tif (git_config_set_gently(\"extensions.relativeWorktrees\", \"true\"))\n+\t\tif (repo_config_set_gently(the_repository, \"extensions.relativeWorktrees\", \"true\"))\n \t\t\tdie(_(\"unable to set extensions.relativeWorktrees setting\"));\n \t\tthe_repository->repository_format_relative_worktrees = 1;\n \t}\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522197","messageId":"20250717-pks-config-wo-the-repository-v1-14-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 14/21] config: drop `git_config_set()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:34Z","receivedAt":"2025-07-17T10:50:14Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_set()`. All\ncallsites are adjusted so that they use `repo_config_set(the_repository,\n...)` instead. While some callsites might already have a repository\navailable, this mechanical conversion is the exact same as the current\nsituation and thus cannot cause any regression. Those sites should\neventually be cleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/branch.c              |  2 +-\n builtin/clone.c               |  8 ++++----\n builtin/gc.c                  |  4 ++--\n builtin/remote.c              | 16 ++++++++--------\n compat/precompose_utf8.c      |  4 ++--\n config.c                      |  2 +-\n config.h                      |  5 -----\n list-objects-filter-options.c |  6 +++---\n setup.c                       | 30 +++++++++++++++---------------\n 9 files changed, 36 insertions(+), 41 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 08e50bf77b3..5de0691d18d 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -699,7 +699,7 @@ static int edit_branch_description(const char *branch_name)\n \n \tstrbuf_addf(&name, \"branch.%s.description\", branch_name);\n \tif (buf.len || exists)\n-\t\tgit_config_set(name.buf, buf.len ? buf.buf : NULL);\n+\t\trepo_config_set(the_repository, name.buf, buf.len ? buf.buf : NULL);\n \tstrbuf_release(&name);\n \tstrbuf_release(&buf);\n \ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 0d7dd5e8ec9..f025a8f19e0 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -827,7 +827,7 @@ static void write_refspec_config(const char *src_ref_prefix,\n \n \t\t\tif (option_mirror) {\n \t\t\t\tstrbuf_addf(&key, \"remote.%s.mirror\", remote_name);\n-\t\t\t\tgit_config_set(key.buf, \"true\");\n+\t\t\t\trepo_config_set(the_repository, key.buf, \"true\");\n \t\t\t\tstrbuf_reset(&key);\n \t\t\t}\n \t\t}\n@@ -1294,18 +1294,18 @@ int cmd_clone(int argc,\n \t\t\tsrc_ref_prefix = \"refs/\";\n \t\tstrbuf_addstr(&branch_top, src_ref_prefix);\n \n-\t\tgit_config_set(\"core.bare\", \"true\");\n+\t\trepo_config_set(the_repository, \"core.bare\", \"true\");\n \t} else if (!option_rev) {\n \t\tstrbuf_addf(&branch_top, \"refs/remotes/%s/\", remote_name);\n \t}\n \n \tstrbuf_addf(&key, \"remote.%s.url\", remote_name);\n-\tgit_config_set(key.buf, repo);\n+\trepo_config_set(the_repository, key.buf, repo);\n \tstrbuf_reset(&key);\n \n \tif (!option_tags) {\n \t\tstrbuf_addf(&key, \"remote.%s.tagOpt\", remote_name);\n-\t\tgit_config_set(key.buf, \"--no-tags\");\n+\t\trepo_config_set(the_repository, key.buf, \"--no-tags\");\n \t\tstrbuf_reset(&key);\n \t}\n \ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex fa62e4f2627..c0fe4e73087 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -1913,11 +1913,11 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,\n \t\t\t\t   options);\n \n \t/* Disable foreground maintenance */\n-\tgit_config_set(\"maintenance.auto\", \"false\");\n+\trepo_config_set(the_repository, \"maintenance.auto\", \"false\");\n \n \t/* Set maintenance strategy, if unset */\n \tif (repo_config_get(the_repository, \"maintenance.strategy\"))\n-\t\tgit_config_set(\"maintenance.strategy\", \"incremental\");\n+\t\trepo_config_set(the_repository, \"maintenance.strategy\", \"incremental\");\n \n \tif (!repo_config_get_string_multi(the_repository, key, &list)) {\n \t\tfor_each_string_list_item(item, list) {\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 5c4dfc98afa..827639e0398 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -209,7 +209,7 @@ static int add(int argc, const char **argv, const char *prefix,\n \t\tdie(_(\"'%s' is not a valid remote name\"), name);\n \n \tstrbuf_addf(&buf, \"remote.%s.url\", name);\n-\tgit_config_set(buf.buf, url);\n+\trepo_config_set(the_repository, buf.buf, url);\n \n \tif (!mirror || mirror & MIRROR_FETCH) {\n \t\tstrbuf_reset(&buf);\n@@ -225,14 +225,14 @@ static int add(int argc, const char **argv, const char *prefix,\n \tif (mirror & MIRROR_PUSH) {\n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addf(&buf, \"remote.%s.mirror\", name);\n-\t\tgit_config_set(buf.buf, \"true\");\n+\t\trepo_config_set(the_repository, buf.buf, \"true\");\n \t}\n \n \tif (fetch_tags != TAGS_DEFAULT) {\n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addf(&buf, \"remote.%s.tagOpt\", name);\n-\t\tgit_config_set(buf.buf,\n-\t\t\t       fetch_tags == TAGS_SET ? \"--tags\" : \"--no-tags\");\n+\t\trepo_config_set(the_repository, buf.buf,\n+\t\t\t\tfetch_tags == TAGS_SET ? \"--tags\" : \"--no-tags\");\n \t}\n \n \tif (fetch && fetch_remote(name)) {\n@@ -802,12 +802,12 @@ static int mv(int argc, const char **argv, const char *prefix,\n \t\tif (info->remote_name && !strcmp(info->remote_name, rename.old_name)) {\n \t\t\tstrbuf_reset(&buf);\n \t\t\tstrbuf_addf(&buf, \"branch.%s.remote\", item->string);\n-\t\t\tgit_config_set(buf.buf, rename.new_name);\n+\t\t\trepo_config_set(the_repository, buf.buf, rename.new_name);\n \t\t}\n \t\tif (info->push_remote_name && !strcmp(info->push_remote_name, rename.old_name)) {\n \t\t\tstrbuf_reset(&buf);\n \t\t\tstrbuf_addf(&buf, \"branch.%s.pushRemote\", item->string);\n-\t\t\tgit_config_set(buf.buf, rename.new_name);\n+\t\t\trepo_config_set(the_repository, buf.buf, rename.new_name);\n \t\t}\n \t}\n \n@@ -1503,7 +1503,7 @@ static int set_head(int argc, const char **argv, const char *prefix,\n \t\tstruct strbuf config_name = STRBUF_INIT;\n \t\tstrbuf_addf(&config_name,\n \t\t\t\"remote.%s.followremotehead\", remote->name);\n-\t\tgit_config_set(config_name.buf, \"warn\");\n+\t\trepo_config_set(the_repository, config_name.buf, \"warn\");\n \t\tstrbuf_release(&config_name);\n \t}\n \n@@ -1793,7 +1793,7 @@ static int set_url(int argc, const char **argv, const char *prefix,\n \t\t\tgit_config_set_multivar(name_buf.buf, newurl,\n \t\t\t\t\t\t       \"^$\", 0);\n \t\telse\n-\t\t\tgit_config_set(name_buf.buf, newurl);\n+\t\t\trepo_config_set(the_repository, name_buf.buf, newurl);\n \t\tgoto out;\n \t}\n \ndiff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c\nindex 3985ed108eb..43b3be01143 100644\n--- a/compat/precompose_utf8.c\n+++ b/compat/precompose_utf8.c\n@@ -56,8 +56,8 @@ void probe_utf8_pathname_composition(void)\n \t\tclose(output_fd);\n \t\trepo_git_path_replace(the_repository, &path, \"%s\", auml_nfd);\n \t\tprecomposed_unicode = access(path.buf, R_OK) ? 0 : 1;\n-\t\tgit_config_set(\"core.precomposeunicode\",\n-\t\t\t       precomposed_unicode ? \"true\" : \"false\");\n+\t\trepo_config_set(the_repository, \"core.precomposeunicode\",\n+\t\t\t\tprecomposed_unicode ? \"true\" : \"false\");\n \t\trepo_git_path_replace(the_repository, &path, \"%s\", auml_nfc);\n \t\tif (unlink(path.buf))\n \t\t\tdie_errno(_(\"failed to unlink '%s'\"), path.buf);\ndiff --git a/config.c b/config.c\nindex 095a17bd429..285cab0ce2a 100644\n--- a/config.c\n+++ b/config.c\n@@ -2748,7 +2748,7 @@ void git_die_config(struct repository *r, const char *key, const char *err, ...)\n }\n \n /*\n- * Find all the stuff for git_config_set() below.\n+ * Find all the stuff for repo_config_set() below.\n  */\n \n struct config_store_data {\ndiff --git a/config.h b/config.h\nindex 90977441c3b..43d06c279e3 100644\n--- a/config.h\n+++ b/config.h\n@@ -734,11 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)\n \treturn repo_config_get_pathname(the_repository, key, dest);\n }\n \n-static inline void git_config_set(const char *key, const char *value)\n-{\n-\trepo_config_set(the_repository, key, value);\n-}\n-\n static inline int git_config_set_in_file_gently(\n \tconst char *config_filename,\n \tconst char *key,\ndiff --git a/list-objects-filter-options.c b/list-objects-filter-options.c\nindex 948376d42d0..7420bf81fe0 100644\n--- a/list-objects-filter-options.c\n+++ b/list-objects-filter-options.c\n@@ -350,7 +350,7 @@ void partial_clone_register(\n \n \t\t/* Add promisor config for the remote */\n \t\tcfg_name = xstrfmt(\"remote.%s.promisor\", remote);\n-\t\tgit_config_set(cfg_name, \"true\");\n+\t\trepo_config_set(the_repository, cfg_name, \"true\");\n \t\tfree(cfg_name);\n \t}\n \n@@ -360,8 +360,8 @@ void partial_clone_register(\n \t */\n \tfilter_name = xstrfmt(\"remote.%s.partialclonefilter\", remote);\n \t/* NEEDSWORK: 'expand' result leaking??? */\n-\tgit_config_set(filter_name,\n-\t\t       expand_list_objects_filter_spec(filter_options));\n+\trepo_config_set(the_repository, filter_name,\n+\t\t\texpand_list_objects_filter_spec(filter_options));\n \tfree(filter_name);\n \n \t/* Make sure the config info are reset */\ndiff --git a/setup.c b/setup.c\nindex a05c348dcdf..98ddbf377f9 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -815,7 +815,7 @@ int upgrade_repository_format(int target_version)\n \t}\n \n \tstrbuf_addf(&repo_version, \"%d\", target_version);\n-\tgit_config_set(\"core.repositoryformatversion\", repo_version.buf);\n+\trepo_config_set(the_repository, \"core.repositoryformatversion\", repo_version.buf);\n \n \tret = 1;\n \n@@ -2233,14 +2233,14 @@ void initialize_repository_version(int hash_algo,\n \t\ttarget_version = GIT_REPO_VERSION_READ;\n \n \tif (hash_algo != GIT_HASH_SHA1_LEGACY && hash_algo != GIT_HASH_UNKNOWN)\n-\t\tgit_config_set(\"extensions.objectformat\",\n-\t\t\t       hash_algos[hash_algo].name);\n+\t\trepo_config_set(the_repository, \"extensions.objectformat\",\n+\t\t\t\thash_algos[hash_algo].name);\n \telse if (reinit)\n \t\trepo_config_set_gently(the_repository, \"extensions.objectformat\", NULL);\n \n \tif (ref_storage_format != REF_STORAGE_FORMAT_FILES)\n-\t\tgit_config_set(\"extensions.refstorage\",\n-\t\t\t       ref_storage_format_to_name(ref_storage_format));\n+\t\trepo_config_set(the_repository, \"extensions.refstorage\",\n+\t\t\t\tref_storage_format_to_name(ref_storage_format));\n \telse if (reinit)\n \t\trepo_config_set_gently(the_repository, \"extensions.refstorage\", NULL);\n \n@@ -2259,7 +2259,7 @@ void initialize_repository_version(int hash_algo,\n \t}\n \n \tstrbuf_addf(&repo_version, \"%d\", target_version);\n-\tgit_config_set(\"core.repositoryformatversion\", repo_version.buf);\n+\trepo_config_set(the_repository, \"core.repositoryformatversion\", repo_version.buf);\n \n \tstrbuf_release(&repo_version);\n }\n@@ -2375,17 +2375,17 @@ static int create_default_files(const char *template_path,\n \t\tif (filemode && !reinit && (st1.st_mode & S_IXUSR))\n \t\t\tfilemode = 0;\n \t}\n-\tgit_config_set(\"core.filemode\", filemode ? \"true\" : \"false\");\n+\trepo_config_set(the_repository, \"core.filemode\", filemode ? \"true\" : \"false\");\n \n \tif (is_bare_repository())\n-\t\tgit_config_set(\"core.bare\", \"true\");\n+\t\trepo_config_set(the_repository, \"core.bare\", \"true\");\n \telse {\n-\t\tgit_config_set(\"core.bare\", \"false\");\n+\t\trepo_config_set(the_repository, \"core.bare\", \"false\");\n \t\t/* allow template config file to override the default */\n \t\tif (repo_settings_get_log_all_ref_updates(the_repository) == LOG_REFS_UNSET)\n-\t\t\tgit_config_set(\"core.logallrefupdates\", \"true\");\n+\t\t\trepo_config_set(the_repository, \"core.logallrefupdates\", \"true\");\n \t\tif (needs_work_tree_config(original_git_dir, work_tree))\n-\t\t\tgit_config_set(\"core.worktree\", work_tree);\n+\t\t\trepo_config_set(the_repository, \"core.worktree\", work_tree);\n \t}\n \n \tif (!reinit) {\n@@ -2398,12 +2398,12 @@ static int create_default_files(const char *template_path,\n \t\t    S_ISLNK(st1.st_mode))\n \t\t\tunlink(path.buf); /* good */\n \t\telse\n-\t\t\tgit_config_set(\"core.symlinks\", \"false\");\n+\t\t\trepo_config_set(the_repository, \"core.symlinks\", \"false\");\n \n \t\t/* Check if the filesystem is case-insensitive */\n \t\trepo_git_path_replace(the_repository, &path, \"CoNfIg\");\n \t\tif (!access(path.buf, F_OK))\n-\t\t\tgit_config_set(\"core.ignorecase\", \"true\");\n+\t\t\trepo_config_set(the_repository, \"core.ignorecase\", \"true\");\n \t\tprobe_utf8_pathname_composition();\n \t}\n \n@@ -2639,8 +2639,8 @@ int init_db(const char *git_dir, const char *real_git_dir,\n \t\t\txsnprintf(buf, sizeof(buf), \"%d\", OLD_PERM_EVERYBODY);\n \t\telse\n \t\t\tBUG(\"invalid value for shared_repository\");\n-\t\tgit_config_set(\"core.sharedrepository\", buf);\n-\t\tgit_config_set(\"receive.denyNonFastforwards\", \"true\");\n+\t\trepo_config_set(the_repository, \"core.sharedrepository\", buf);\n+\t\trepo_config_set(the_repository, \"receive.denyNonFastforwards\", \"true\");\n \t}\n \n \tif (!(flags & INIT_DB_QUIET)) {\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522198","messageId":"20250717-pks-config-wo-the-repository-v1-15-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 15/21] config: drop `git_config_set_in_file_gently()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:35Z","receivedAt":"2025-07-17T10:50:18Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove\n`git_config_set_in_file_gently()`. All callsites are adjusted so that\nthey use `repo_config_set_in_file_gently(the_repository, ...)` instead.\nWhile some callsites might already have a repository available, this\nmechanical conversion is the exact same as the current situation and\nthus cannot cause any regression. Those sites should eventually be\ncleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/config.c            | 14 +++++++-------\n builtin/submodule--helper.c |  2 +-\n builtin/worktree.c          |  4 ++--\n config.h                    | 10 ----------\n sequencer.c                 | 28 ++++++++++++++--------------\n submodule-config.c          |  2 +-\n submodule.c                 |  2 +-\n worktree.c                  |  4 ++--\n 8 files changed, 28 insertions(+), 38 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex af5d79eadc0..f7e718c6702 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -970,8 +970,8 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix,\n \t\t\t\t\t\t\t     argv[0], value, value_pattern,\n \t\t\t\t\t\t\t     comment, flags);\n \t} else {\n-\t\tret = git_config_set_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t    argv[0], comment, value);\n+\t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t     argv[0], comment, value);\n \t\tif (ret == CONFIG_NOTHING_SET)\n \t\t\terror(_(\"cannot overwrite multiple values with a single value\\n\"\n \t\t\t\"       Use a regexp, --add or --replace-all to change %s.\"), argv[0]);\n@@ -1014,8 +1014,8 @@ static int cmd_config_unset(int argc, const char **argv, const char *prefix,\n \t\t\t\t\t\t\t     argv[0], NULL, value_pattern,\n \t\t\t\t\t\t\t     NULL, flags);\n \telse\n-\t\tret = git_config_set_in_file_gently(location_opts.source.file, argv[0],\n-\t\t\t\t\t\t    NULL, NULL);\n+\t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0],\n+\t\t\t\t\t\t     NULL, NULL);\n \n \tlocation_options_release(&location_opts);\n \treturn ret;\n@@ -1296,7 +1296,7 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)\n \t\tcheck_write(&location_opts.source);\n \t\tcheck_argc(argc, 2, 2);\n \t\tvalue = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);\n-\t\tret = git_config_set_in_file_gently(location_opts.source.file, argv[0], comment, value);\n+\t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0], comment, value);\n \t\tif (ret == CONFIG_NOTHING_SET)\n \t\t\terror(_(\"cannot overwrite multiple values with a single value\\n\"\n \t\t\t\"       Use a regexp, --add or --replace-all to change %s.\"), argv[0]);\n@@ -1354,8 +1354,8 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)\n \t\t\t\t\t\t\t\t     argv[0], NULL, argv[1],\n \t\t\t\t\t\t\t\t     NULL, flags);\n \t\telse\n-\t\t\tret = git_config_set_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t    argv[0], NULL, NULL);\n+\t\t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t     argv[0], NULL, NULL);\n \t}\n \telse if (actions == ACTION_UNSET_ALL) {\n \t\tcheck_write(&location_opts.source);\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 710a2a2004e..28f34f7bc18 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1280,7 +1280,7 @@ static void sync_submodule(const char *path, const char *prefix,\n \tsubmodule_to_gitdir(the_repository, &sb, path);\n \tstrbuf_addstr(&sb, \"/config\");\n \n-\tif (git_config_set_in_file_gently(sb.buf, remote_key, NULL, sub_origin_url))\n+\tif (repo_config_set_in_file_gently(the_repository, sb.buf, remote_key, NULL, sub_origin_url))\n \t\tdie(_(\"failed to update remote for submodule '%s'\"),\n \t\t      path);\n \ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex b1306248dec..fd517c82c44 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -384,8 +384,8 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)\n \t\t\terror(_(\"failed to unset '%s' in '%s'\"),\n \t\t\t\t\"core.bare\", to_file);\n \t\tif (!git_configset_get(&cs, \"core.worktree\") &&\n-\t\t\tgit_config_set_in_file_gently(to_file,\n-\t\t\t\t\t\t\t\"core.worktree\", NULL, NULL))\n+\t\t\trepo_config_set_in_file_gently(the_repository, to_file,\n+\t\t\t\t\t\t       \"core.worktree\", NULL, NULL))\n \t\t\terror(_(\"failed to unset '%s' in '%s'\"),\n \t\t\t\t\"core.worktree\", to_file);\n \ndiff --git a/config.h b/config.h\nindex 43d06c279e3..4e658e47f0a 100644\n--- a/config.h\n+++ b/config.h\n@@ -734,16 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)\n \treturn repo_config_get_pathname(the_repository, key, dest);\n }\n \n-static inline int git_config_set_in_file_gently(\n-\tconst char *config_filename,\n-\tconst char *key,\n-\tconst char *comment,\n-\tconst char *value)\n-{\n-\treturn repo_config_set_in_file_gently(the_repository, config_filename,\n-\t\t\t\t\t      key, comment, value);\n-}\n-\n static inline int git_config_set_multivar_in_file_gently(\n \tconst char *config_filename,\n \tconst char *key, const char *value,\ndiff --git a/sequencer.c b/sequencer.c\nindex f8d9bb69df8..8acb699f4f2 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -3650,57 +3650,57 @@ static int save_opts(struct replay_opts *opts)\n \tint res = 0;\n \n \tif (opts->no_commit)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.no-commit\", NULL, \"true\");\n \tif (opts->edit >= 0)\n-\t\tres |= git_config_set_in_file_gently(opts_file, \"options.edit\", NULL,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file, \"options.edit\", NULL,\n \t\t\t\t\t\t     opts->edit ? \"true\" : \"false\");\n \tif (opts->allow_empty)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.allow-empty\", NULL, \"true\");\n \tif (opts->allow_empty_message)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\"options.allow-empty-message\", NULL, \"true\");\n \tif (opts->drop_redundant_commits)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\"options.drop-redundant-commits\", NULL, \"true\");\n \tif (opts->keep_redundant_commits)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\"options.keep-redundant-commits\", NULL, \"true\");\n \tif (opts->signoff)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.signoff\", NULL, \"true\");\n \tif (opts->record_origin)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.record-origin\", NULL, \"true\");\n \tif (opts->allow_ff)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.allow-ff\", NULL, \"true\");\n \tif (opts->mainline) {\n \t\tstruct strbuf buf = STRBUF_INIT;\n \t\tstrbuf_addf(&buf, \"%d\", opts->mainline);\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.mainline\", NULL, buf.buf);\n \t\tstrbuf_release(&buf);\n \t}\n \tif (opts->strategy)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.strategy\", NULL, opts->strategy);\n \tif (opts->gpg_sign)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.gpg-sign\", NULL, opts->gpg_sign);\n \tfor (size_t i = 0; i < opts->xopts.nr; i++)\n \t\tres |= git_config_set_multivar_in_file_gently(opts_file,\n \t\t\t\t\"options.strategy-option\",\n \t\t\t\topts->xopts.v[i], \"^$\", NULL, 0);\n \tif (opts->allow_rerere_auto)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\"options.allow-rerere-auto\", NULL,\n \t\t\t\topts->allow_rerere_auto == RERERE_AUTOUPDATE ?\n \t\t\t\t\"true\" : \"false\");\n \n \tif (opts->explicit_cleanup)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\"options.default-msg-cleanup\", NULL,\n \t\t\t\tdescribe_cleanup_mode(opts->default_msg_cleanup));\n \treturn res;\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 70324da3830..1f19fe20774 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -983,7 +983,7 @@ int config_set_in_gitmodules_file_gently(const char *key, const char *value)\n {\n \tint ret;\n \n-\tret = git_config_set_in_file_gently(GITMODULES_FILE, key, NULL, value);\n+\tret = repo_config_set_in_file_gently(the_repository, GITMODULES_FILE, key, NULL, value);\n \tif (ret < 0)\n \t\t/* Maybe the user already did that, don't error out here */\n \t\twarning(_(\"Could not update .gitmodules entry %s\"), key);\ndiff --git a/submodule.c b/submodule.c\nindex f8373a9ea7d..fff3c755703 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -2058,7 +2058,7 @@ void submodule_unset_core_worktree(const struct submodule *sub)\n \tsubmodule_name_to_gitdir(&config_path, the_repository, sub->name);\n \tstrbuf_addstr(&config_path, \"/config\");\n \n-\tif (git_config_set_in_file_gently(config_path.buf, \"core.worktree\", NULL, NULL))\n+\tif (repo_config_set_in_file_gently(the_repository, config_path.buf, \"core.worktree\", NULL, NULL))\n \t\twarning(_(\"Could not unset core.worktree setting in submodule '%s'\"),\n \t\t\t  sub->path);\n \ndiff --git a/worktree.c b/worktree.c\nindex 981a2713374..a2a5f51f29f 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -991,9 +991,9 @@ int should_prune_worktree(const char *id, struct strbuf *reason, char **wtpath,\n static int move_config_setting(const char *key, const char *value,\n \t\t\t       const char *from_file, const char *to_file)\n {\n-\tif (git_config_set_in_file_gently(to_file, key, NULL, value))\n+\tif (repo_config_set_in_file_gently(the_repository, to_file, key, NULL, value))\n \t\treturn error(_(\"unable to set %s in '%s'\"), key, to_file);\n-\tif (git_config_set_in_file_gently(from_file, key, NULL, NULL))\n+\tif (repo_config_set_in_file_gently(the_repository, from_file, key, NULL, NULL))\n \t\treturn error(_(\"unable to unset %s in '%s'\"), key, from_file);\n \treturn 0;\n }\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522199","messageId":"20250717-pks-config-wo-the-repository-v1-16-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 16/21] config: drop `git_config_set_multivar_in_file_gently()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:36Z","receivedAt":"2025-07-17T10:50:21Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove\n`git_config_set_multivar_in_file_gently()`. All callsites are adjusted\nso that they use\n`repo_config_set_multivar_in_file_gently(the_repository, ...)` instead.\nWhile some callsites might already have a repository available, this\nmechanical conversion is the exact same as the current situation and\nthus cannot cause any regression. Those sites should eventually be\ncleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/config.c   | 44 ++++++++++++++++++++++----------------------\n builtin/gc.c       |  4 ++--\n builtin/worktree.c |  2 +-\n config.h           | 12 ------------\n sequencer.c        |  2 +-\n 5 files changed, 26 insertions(+), 38 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex f7e718c6702..59fb113b073 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -966,9 +966,9 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix,\n \tvalue = normalize_value(argv[0], argv[1], type, &default_kvi);\n \n \tif ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern) {\n-\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t     argv[0], value, value_pattern,\n-\t\t\t\t\t\t\t     comment, flags);\n+\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t      argv[0], value, value_pattern,\n+\t\t\t\t\t\t\t      comment, flags);\n \t} else {\n \t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,\n \t\t\t\t\t\t     argv[0], comment, value);\n@@ -1010,9 +1010,9 @@ static int cmd_config_unset(int argc, const char **argv, const char *prefix,\n \tcheck_write(&location_opts.source);\n \n \tif ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern)\n-\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t     argv[0], NULL, value_pattern,\n-\t\t\t\t\t\t\t     NULL, flags);\n+\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t      argv[0], NULL, value_pattern,\n+\t\t\t\t\t\t\t      NULL, flags);\n \telse\n \t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0],\n \t\t\t\t\t\t     NULL, NULL);\n@@ -1305,26 +1305,26 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)\n \t\tcheck_write(&location_opts.source);\n \t\tcheck_argc(argc, 2, 3);\n \t\tvalue = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);\n-\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t     argv[0], value, argv[2],\n-\t\t\t\t\t\t\t     comment, flags);\n+\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t      argv[0], value, argv[2],\n+\t\t\t\t\t\t\t      comment, flags);\n \t}\n \telse if (actions == ACTION_ADD) {\n \t\tcheck_write(&location_opts.source);\n \t\tcheck_argc(argc, 2, 2);\n \t\tvalue = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);\n-\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t     argv[0], value,\n-\t\t\t\t\t\t\t     CONFIG_REGEX_NONE,\n-\t\t\t\t\t\t\t     comment, flags);\n+\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t      argv[0], value,\n+\t\t\t\t\t\t\t      CONFIG_REGEX_NONE,\n+\t\t\t\t\t\t\t      comment, flags);\n \t}\n \telse if (actions == ACTION_REPLACE_ALL) {\n \t\tcheck_write(&location_opts.source);\n \t\tcheck_argc(argc, 2, 3);\n \t\tvalue = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);\n-\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t     argv[0], value, argv[2],\n-\t\t\t\t\t\t\t     comment, flags | CONFIG_FLAGS_MULTI_REPLACE);\n+\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t      argv[0], value, argv[2],\n+\t\t\t\t\t\t\t      comment, flags | CONFIG_FLAGS_MULTI_REPLACE);\n \t}\n \telse if (actions == ACTION_GET) {\n \t\tcheck_argc(argc, 1, 2);\n@@ -1350,9 +1350,9 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)\n \t\tcheck_write(&location_opts.source);\n \t\tcheck_argc(argc, 1, 2);\n \t\tif (argc == 2)\n-\t\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t\t     argv[0], NULL, argv[1],\n-\t\t\t\t\t\t\t\t     NULL, flags);\n+\t\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t\t      argv[0], NULL, argv[1],\n+\t\t\t\t\t\t\t\t      NULL, flags);\n \t\telse\n \t\t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,\n \t\t\t\t\t\t\t     argv[0], NULL, NULL);\n@@ -1360,9 +1360,9 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)\n \telse if (actions == ACTION_UNSET_ALL) {\n \t\tcheck_write(&location_opts.source);\n \t\tcheck_argc(argc, 1, 2);\n-\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t     argv[0], NULL, argv[1],\n-\t\t\t\t\t\t\t     NULL, flags | CONFIG_FLAGS_MULTI_REPLACE);\n+\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t      argv[0], NULL, argv[1],\n+\t\t\t\t\t\t\t      NULL, flags | CONFIG_FLAGS_MULTI_REPLACE);\n \t}\n \telse if (actions == ACTION_RENAME_SECTION) {\n \t\tcheck_write(&location_opts.source);\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex c0fe4e73087..183798f0dc9 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -1938,7 +1938,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,\n \t\t}\n \t\tif (!config_file)\n \t\t\tdie(_(\"$HOME not set\"));\n-\t\trc = git_config_set_multivar_in_file_gently(\n+\t\trc = repo_config_set_multivar_in_file_gently(the_repository,\n \t\t\tconfig_file, \"maintenance.repo\", maintpath,\n \t\t\tCONFIG_REGEX_NONE, NULL, 0);\n \t\tfree(global_config_file);\n@@ -2007,7 +2007,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi\n \t\t}\n \t\tif (!config_file)\n \t\t\tdie(_(\"$HOME not set\"));\n-\t\trc = git_config_set_multivar_in_file_gently(\n+\t\trc = repo_config_set_multivar_in_file_gently(the_repository,\n \t\t\tconfig_file, key, NULL, maintpath, NULL,\n \t\t\tCONFIG_FLAGS_MULTI_REPLACE | CONFIG_FLAGS_FIXED_VALUE);\n \t\tfree(global_config_file);\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex fd517c82c44..812774a5ca9 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -379,7 +379,7 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)\n \n \t\tif (!git_configset_get_bool(&cs, \"core.bare\", &bare) &&\n \t\t\tbare &&\n-\t\t\tgit_config_set_multivar_in_file_gently(\n+\t\t\trepo_config_set_multivar_in_file_gently(the_repository,\n \t\t\t\tto_file, \"core.bare\", NULL, \"true\", NULL, 0))\n \t\t\terror(_(\"failed to unset '%s' in '%s'\"),\n \t\t\t\t\"core.bare\", to_file);\ndiff --git a/config.h b/config.h\nindex 4e658e47f0a..e69592ada15 100644\n--- a/config.h\n+++ b/config.h\n@@ -734,18 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)\n \treturn repo_config_get_pathname(the_repository, key, dest);\n }\n \n-static inline int git_config_set_multivar_in_file_gently(\n-\tconst char *config_filename,\n-\tconst char *key, const char *value,\n-\tconst char *value_pattern,\n-\tconst char *comment,\n-\tunsigned flags)\n-{\n-\treturn repo_config_set_multivar_in_file_gently(the_repository, config_filename,\n-\t\t\t\t\t\t       key, value, value_pattern,\n-\t\t\t\t\t\t       comment, flags);\n-}\n-\n static inline void git_config_set_multivar_in_file(\n \tconst char *config_filename,\n \tconst char *key,\ndiff --git a/sequencer.c b/sequencer.c\nindex 8acb699f4f2..aaf2e4df64e 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -3690,7 +3690,7 @@ static int save_opts(struct replay_opts *opts)\n \t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.gpg-sign\", NULL, opts->gpg_sign);\n \tfor (size_t i = 0; i < opts->xopts.nr; i++)\n-\t\tres |= git_config_set_multivar_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_multivar_in_file_gently(the_repository, opts_file,\n \t\t\t\t\"options.strategy-option\",\n \t\t\t\topts->xopts.v[i], \"^$\", NULL, 0);\n \tif (opts->allow_rerere_auto)\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522200","messageId":"20250717-pks-config-wo-the-repository-v1-17-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 17/21] config: drop `git_config_get_multivar_gently()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:37Z","receivedAt":"2025-07-17T10:50:24Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove\n`git_config_get_multivar_gently()`. All callsites are adjusted so that\nthey use `repo_config_get_multivar_gently(the_repository, ...)` instead.\nWhile some callsites might already have a repository available, this\nmechanical conversion is the exact same as the current situation and\nthus cannot cause any regression. Those sites should eventually be\ncleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n branch.c         | 2 +-\n builtin/clone.c  | 8 ++++----\n builtin/remote.c | 4 ++--\n config.h         | 7 -------\n scalar.c         | 6 +++---\n 5 files changed, 10 insertions(+), 17 deletions(-)\n\ndiff --git a/branch.c b/branch.c\nindex 3dc237adf6c..26be3583471 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -130,7 +130,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,\n \tif (repo_config_set_gently(the_repository, key.buf, NULL) < 0)\n \t\tgoto out_err;\n \tfor_each_string_list_item(item, remotes)\n-\t\tif (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)\n+\t\tif (repo_config_set_multivar_gently(the_repository, key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)\n \t\t\tgoto out_err;\n \n \tif (rebasing) {\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex f025a8f19e0..183297787cb 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -762,16 +762,16 @@ static int write_one_config(const char *key, const char *value,\n {\n \t/*\n \t * give git_clone_config a chance to write config values back to the\n-\t * environment, since git_config_set_multivar_gently only deals with\n+\t * environment, since repo_config_set_multivar_gently only deals with\n \t * config-file writes\n \t */\n \tint apply_failed = git_clone_config(key, value, ctx, data);\n \tif (apply_failed)\n \t\treturn apply_failed;\n \n-\treturn git_config_set_multivar_gently(key,\n-\t\t\t\t\t      value ? value : \"true\",\n-\t\t\t\t\t      CONFIG_REGEX_NONE, 0);\n+\treturn repo_config_set_multivar_gently(the_repository, key,\n+\t\t\t\t\t       value ? value : \"true\",\n+\t\t\t\t\t       CONFIG_REGEX_NONE, 0);\n }\n \n static void write_config(struct string_list *config)\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 827639e0398..dd340a33259 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -1633,8 +1633,8 @@ static int update(int argc, const char **argv, const char *prefix,\n \n static int remove_all_fetch_refspecs(const char *key)\n {\n-\treturn git_config_set_multivar_gently(key, NULL, NULL,\n-\t\t\t\t\t      CONFIG_FLAGS_MULTI_REPLACE);\n+\treturn repo_config_set_multivar_gently(the_repository, key, NULL, NULL,\n+\t\t\t\t\t       CONFIG_FLAGS_MULTI_REPLACE);\n }\n \n static void add_branches(struct remote *remote, const char **branches,\ndiff --git a/config.h b/config.h\nindex e69592ada15..a90b814292c 100644\n--- a/config.h\n+++ b/config.h\n@@ -745,13 +745,6 @@ static inline void git_config_set_multivar_in_file(\n \t\t\t\t\t key, value, value_pattern, flags);\n }\n \n-static inline int git_config_set_multivar_gently(const char *key, const char *value,\n-\t\t\t\t   const char *value_pattern, unsigned flags)\n-{\n-\treturn repo_config_set_multivar_gently(the_repository, key, value,\n-\t\t\t\t\t       value_pattern, flags);\n-}\n-\n static inline void git_config_set_multivar(const char *key, const char *value,\n \t\t\t     const char *value_pattern, unsigned flags)\n {\ndiff --git a/scalar.c b/scalar.c\nindex c09c5ca194e..4a373c133d8 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -196,9 +196,9 @@ static int set_recommended_config(int reconfigure)\n \tif (repo_config_get_string(the_repository, \"log.excludeDecoration\", &value)) {\n \t\ttrace2_data_string(\"scalar\", the_repository,\n \t\t\t\t   \"log.excludeDecoration\", \"created\");\n-\t\tif (git_config_set_multivar_gently(\"log.excludeDecoration\",\n-\t\t\t\t\t\t   \"refs/prefetch/*\",\n-\t\t\t\t\t\t   CONFIG_REGEX_NONE, 0))\n+\t\tif (repo_config_set_multivar_gently(the_repository, \"log.excludeDecoration\",\n+\t\t\t\t\t\t    \"refs/prefetch/*\",\n+\t\t\t\t\t\t    CONFIG_REGEX_NONE, 0))\n \t\t\treturn error(_(\"could not configure \"\n \t\t\t\t       \"log.excludeDecoration\"));\n \t} else {\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522201","messageId":"20250717-pks-config-wo-the-repository-v1-18-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 18/21] config: drop `git_config_set_multivar()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:38Z","receivedAt":"2025-07-17T10:50:27Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_set_multivar()`.\nAll callsites are adjusted so that they use\n`repo_config_set_multivar(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/branch.c |  4 ++--\n builtin/clone.c  |  2 +-\n builtin/remote.c | 20 ++++++++++----------\n config.h         |  7 -------\n 4 files changed, 13 insertions(+), 20 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 5de0691d18d..fa5ced452e5 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -987,10 +987,10 @@ int cmd_branch(int argc,\n \n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addf(&buf, \"branch.%s.remote\", branch->name);\n-\t\tgit_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);\n+\t\trepo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);\n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addf(&buf, \"branch.%s.merge\", branch->name);\n-\t\tgit_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);\n+\t\trepo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);\n \t\tstrbuf_release(&buf);\n \t} else if (!noncreate_actions && argc > 0 && argc <= 2) {\n \t\tconst char *branch_name = argv[0];\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 183297787cb..c990f398ef6 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -822,7 +822,7 @@ static void write_refspec_config(const char *src_ref_prefix,\n \t\t/* Configure the remote */\n \t\tif (value.len) {\n \t\t\tstrbuf_addf(&key, \"remote.%s.fetch\", remote_name);\n-\t\t\tgit_config_set_multivar(key.buf, value.buf, \"^$\", 0);\n+\t\t\trepo_config_set_multivar(the_repository, key.buf, value.buf, \"^$\", 0);\n \t\t\tstrbuf_reset(&key);\n \n \t\t\tif (option_mirror) {\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex dd340a33259..4c63a8bb576 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -132,7 +132,7 @@ static void add_branch(const char *key, const char *branchname,\n \telse\n \t\tstrbuf_addf(tmp, \"refs/heads/%s:refs/remotes/%s/%s\",\n \t\t\t\tbranchname, remotename, branchname);\n-\tgit_config_set_multivar(key, tmp->buf, \"^$\", 0);\n+\trepo_config_set_multivar(the_repository, key, tmp->buf, \"^$\", 0);\n }\n \n static const char mirror_advice[] =\n@@ -634,15 +634,15 @@ static int migrate_file(struct remote *remote)\n \n \tstrbuf_addf(&buf, \"remote.%s.url\", remote->name);\n \tfor (i = 0; i < remote->url.nr; i++)\n-\t\tgit_config_set_multivar(buf.buf, remote->url.v[i], \"^$\", 0);\n+\t\trepo_config_set_multivar(the_repository, buf.buf, remote->url.v[i], \"^$\", 0);\n \tstrbuf_reset(&buf);\n \tstrbuf_addf(&buf, \"remote.%s.push\", remote->name);\n \tfor (i = 0; i < remote->push.nr; i++)\n-\t\tgit_config_set_multivar(buf.buf, remote->push.items[i].raw, \"^$\", 0);\n+\t\trepo_config_set_multivar(the_repository, buf.buf, remote->push.items[i].raw, \"^$\", 0);\n \tstrbuf_reset(&buf);\n \tstrbuf_addf(&buf, \"remote.%s.fetch\", remote->name);\n \tfor (i = 0; i < remote->fetch.nr; i++)\n-\t\tgit_config_set_multivar(buf.buf, remote->fetch.items[i].raw, \"^$\", 0);\n+\t\trepo_config_set_multivar(the_repository, buf.buf, remote->fetch.items[i].raw, \"^$\", 0);\n #ifndef WITH_BREAKING_CHANGES\n \tif (remote->origin == REMOTE_REMOTES)\n \t\tunlink_or_warn(repo_git_path_replace(the_repository, &buf,\n@@ -771,7 +771,7 @@ static int mv(int argc, const char **argv, const char *prefix,\n \tif (oldremote->fetch.nr) {\n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addf(&buf, \"remote.%s.fetch\", rename.new_name);\n-\t\tgit_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);\n+\t\trepo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);\n \t\tstrbuf_addf(&old_remote_context, \":refs/remotes/%s/\", rename.old_name);\n \t\tfor (i = 0; i < oldremote->fetch.nr; i++) {\n \t\t\tchar *ptr;\n@@ -791,7 +791,7 @@ static int mv(int argc, const char **argv, const char *prefix,\n \t\t\t\t\t  \"\\tPlease update the configuration manually if necessary.\"),\n \t\t\t\t\tbuf2.buf);\n \n-\t\t\tgit_config_set_multivar(buf.buf, buf2.buf, \"^$\", 0);\n+\t\t\trepo_config_set_multivar(the_repository, buf.buf, buf2.buf, \"^$\", 0);\n \t\t}\n \t}\n \n@@ -1790,7 +1790,7 @@ static int set_url(int argc, const char **argv, const char *prefix,\n \t/* Special cases that add new entry. */\n \tif ((!oldurl && !delete_mode) || add_mode) {\n \t\tif (add_mode)\n-\t\t\tgit_config_set_multivar(name_buf.buf, newurl,\n+\t\t\trepo_config_set_multivar(the_repository, name_buf.buf, newurl,\n \t\t\t\t\t\t       \"^$\", 0);\n \t\telse\n \t\t\trepo_config_set(the_repository, name_buf.buf, newurl);\n@@ -1814,10 +1814,10 @@ static int set_url(int argc, const char **argv, const char *prefix,\n \tregfree(&old_regex);\n \n \tif (!delete_mode)\n-\t\tgit_config_set_multivar(name_buf.buf, newurl, oldurl, 0);\n+\t\trepo_config_set_multivar(the_repository, name_buf.buf, newurl, oldurl, 0);\n \telse\n-\t\tgit_config_set_multivar(name_buf.buf, NULL, oldurl,\n-\t\t\t\t\tCONFIG_FLAGS_MULTI_REPLACE);\n+\t\trepo_config_set_multivar(the_repository, name_buf.buf, NULL, oldurl,\n+\t\t\t\t\t CONFIG_FLAGS_MULTI_REPLACE);\n out:\n \tstrbuf_release(&name_buf);\n \treturn 0;\ndiff --git a/config.h b/config.h\nindex a90b814292c..61774f17db3 100644\n--- a/config.h\n+++ b/config.h\n@@ -744,13 +744,6 @@ static inline void git_config_set_multivar_in_file(\n \trepo_config_set_multivar_in_file(the_repository, config_filename,\n \t\t\t\t\t key, value, value_pattern, flags);\n }\n-\n-static inline void git_config_set_multivar(const char *key, const char *value,\n-\t\t\t     const char *value_pattern, unsigned flags)\n-{\n-\trepo_config_set_multivar(the_repository, key, value,\n-\t\t\t\t value_pattern, flags);\n-}\n # endif /* USE_THE_REPOSITORY_VARIABLE */\n \n #endif /* CONFIG_H */\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522202","messageId":"20250717-pks-config-wo-the-repository-v1-19-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 19/21] config: remove unused `the_repository` wrappers","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:39Z","receivedAt":"2025-07-17T10:50:31Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Remove the last couple of wrapper functions that implicitly depend on\n`the_repository`.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n config.h | 28 ----------------------------\n 1 file changed, 28 deletions(-)\n\ndiff --git a/config.h b/config.h\nindex 61774f17db3..87baf8eeffe 100644\n--- a/config.h\n+++ b/config.h\n@@ -718,32 +718,4 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n \tlookup_config(mapping, ARRAY_SIZE(mapping), var)\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n-# ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest)\n-{\n-\treturn repo_config_get_bool_or_int(the_repository, key, is_bool, dest);\n-}\n-\n-static inline int git_config_get_maybe_bool(const char *key, int *dest)\n-{\n-\treturn repo_config_get_maybe_bool(the_repository, key, dest);\n-}\n-\n-static inline int git_config_get_pathname(const char *key, char **dest)\n-{\n-\treturn repo_config_get_pathname(the_repository, key, dest);\n-}\n-\n-static inline void git_config_set_multivar_in_file(\n-\tconst char *config_filename,\n-\tconst char *key,\n-\tconst char *value,\n-\tconst char *value_pattern,\n-\tunsigned flags)\n-{\n-\trepo_config_set_multivar_in_file(the_repository, config_filename,\n-\t\t\t\t\t key, value, value_pattern, flags);\n-}\n-# endif /* USE_THE_REPOSITORY_VARIABLE */\n-\n #endif /* CONFIG_H */\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522203","messageId":"20250717-pks-config-wo-the-repository-v1-20-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 20/21] config: move Git config parsing into \"environment.c\"","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:40Z","receivedAt":"2025-07-17T10:50:34Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In \"config.c\" we host both the business logic to read and write config\nfiles as well as the logic to parse specific Git-related variables. On\nthe one hand this is mixing concerns, but even more importantly it means\nthat we cannot easily remove the dependency on `the_repository` in our\nconfig parsing logic.\n\nMove the logic into \"environment.c\". This file is a grab bag of all\nkinds of global state already, so it is quite a good fit. Furthermore,\nit also hosts most of the global variables that we're parsing the config\nvalues into, making this an even better fit.\n\nNote that there is one hidden change: in `parse_fsync_components()` we\nuse an `int` to iterate through `ARRAY_SIZE(fsync_component_names)`. But\nas -Wsign-compare warnings are enabled in this file this causes a\ncompiler warning. The issue is fixed by using a `size_t` instead.\n\nThis change allows us to drop the `USE_THE_REPOSITORY_VARIABLE`\ndeclaration.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/add.c                |   1 +\n builtin/check-ignore.c       |   1 +\n builtin/check-mailmap.c      |   1 +\n builtin/checkout--worker.c   |   1 +\n builtin/checkout-index.c     |   1 +\n builtin/clean.c              |   1 +\n builtin/commit-graph.c       |   1 +\n builtin/commit-tree.c        |   1 +\n builtin/count-objects.c      |   1 +\n builtin/credential.c         |   1 +\n builtin/fast-export.c        |   1 +\n builtin/for-each-ref.c       |   1 +\n builtin/fsmonitor--daemon.c  |   1 +\n builtin/grep.c               |   1 +\n builtin/hash-object.c        |   1 +\n builtin/help.c               |   1 +\n builtin/hook.c               |   1 +\n builtin/interpret-trailers.c |   1 +\n builtin/ls-files.c           |   1 +\n builtin/ls-tree.c            |   1 +\n builtin/merge-base.c         |   1 +\n builtin/merge-tree.c         |   1 +\n builtin/multi-pack-index.c   |   1 +\n builtin/pack-refs.c          |   1 +\n builtin/patch-id.c           |   1 +\n builtin/pull.c               |   1 +\n builtin/read-tree.c          |   1 +\n builtin/replace.c            |   1 +\n builtin/rm.c                 |   1 +\n builtin/send-pack.c          |   1 +\n builtin/show-ref.c           |   1 +\n builtin/symbolic-ref.c       |   1 +\n builtin/unpack-file.c        |   1 +\n builtin/update-ref.c         |   1 +\n builtin/update-server-info.c |   1 +\n builtin/var.c                |   1 +\n builtin/verify-commit.c      |   1 +\n builtin/verify-pack.c        |   1 +\n builtin/verify-tag.c         |   1 +\n builtin/write-tree.c         |   1 +\n commit-graph.c               |   1 +\n config.c                     | 511 ------------------------------------------\n config.h                     |   3 -\n environment.c                | 512 +++++++++++++++++++++++++++++++++++++++++++\n environment.h                |   3 +\n fsck.c                       |   1 +\n http-fetch.c                 |   1 +\n http.c                       |   1 +\n imap-send.c                  |   1 +\n mailinfo.c                   |   1 +\n reflog.c                     |   1 +\n rerere.c                     |   1 +\n t/helper/test-advise.c       |   1 +\n t/helper/test-read-cache.c   |   1 +\n xdiff-interface.c            |   1 +\n 55 files changed, 566 insertions(+), 514 deletions(-)\n\ndiff --git a/builtin/add.c b/builtin/add.c\nindex 7c292ffdc6c..88d1d330fa8 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -7,6 +7,7 @@\n #include \"builtin.h\"\n #include \"advice.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"lockfile.h\"\n #include \"editor.h\"\n #include \"dir.h\"\ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex 03033499cb0..644c9a414ff 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"quote.h\"\n #include \"pathspec.h\"\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex 634626c6728..9cc5c598302 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"ident.h\"\n #include \"mailmap.h\"\ndiff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c\nindex 27a7d4f0409..e0772b718b2 100644\n--- a/builtin/checkout--worker.c\n+++ b/builtin/checkout--worker.c\n@@ -4,6 +4,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"entry.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parallel-checkout.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/checkout-index.c b/builtin/checkout-index.c\nindex 7f74bc702fa..188128aebd9 100644\n--- a/builtin/checkout-index.c\n+++ b/builtin/checkout-index.c\n@@ -9,6 +9,7 @@\n \n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 5ee147c4acc..a1977b92dc8 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -13,6 +13,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"path.h\"\ndiff --git a/builtin/commit-graph.c b/builtin/commit-graph.c\nindex c5cc601844c..4992ac146e1 100644\n--- a/builtin/commit-graph.c\n+++ b/builtin/commit-graph.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"commit.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex 2f1df28d413..5189e685a7e 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -6,6 +6,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-name.h\"\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex 433daff805a..b1148a68fa8 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -7,6 +7,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"path.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/credential.c b/builtin/credential.c\nindex 52f172e80cb..a295c80b366 100644\n--- a/builtin/credential.c\n+++ b/builtin/credential.c\n@@ -3,6 +3,7 @@\n #include \"git-compat-util.h\"\n #include \"credential.h\"\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"config.h\"\n \n static const char usage_msg[] =\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 17027b859e0..66a3a98c938 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -9,6 +9,7 @@\n \n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c\nindex 3d2207ec773..a8f7f8c7625 100644\n--- a/builtin/for-each-ref.c\n+++ b/builtin/for-each-ref.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"commit.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"object.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c\nindex 469c62b555b..242c594646d 100644\n--- a/builtin/fsmonitor--daemon.c\n+++ b/builtin/fsmonitor--daemon.c\n@@ -5,6 +5,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"fsmonitor-ll.h\"\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 8fcb69dbf2c..5df65373337 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -9,6 +9,7 @@\n \n #include \"builtin.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"config.h\"\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex c3ad1e91c96..5d900a6b8c9 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -8,6 +8,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-file.h\"\ndiff --git a/builtin/help.c b/builtin/help.c\nindex d79ecd946a6..c09cbc8912d 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -6,6 +6,7 @@\n \n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"pager.h\"\ndiff --git a/builtin/hook.c b/builtin/hook.c\nindex 044c27aa95d..7afec380d2e 100644\n--- a/builtin/hook.c\n+++ b/builtin/hook.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hook.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c\nindex 3141c37b853..41b0750e5af 100644\n--- a/builtin/interpret-trailers.c\n+++ b/builtin/interpret-trailers.c\n@@ -6,6 +6,7 @@\n  */\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex ff975e7be06..c06a6f33e41 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -11,6 +11,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"convert.h\"\n+#include \"environment.h\"\n #include \"quote.h\"\n #include \"dir.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex 4ba84e51967..5d55731ca35 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -7,6 +7,7 @@\n #include \"builtin.h\"\n \n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-name.h\"\ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex 8fde35c1751..3f82781245b 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-name.h\"\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex 99a6495fd52..203f0e6456a 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n \n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"tree-walk.h\"\n #include \"xdiff-interface.h\"\n #include \"help.h\"\ndiff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c\nindex 9a113f0f1f3..d3b9e98be37 100644\n--- a/builtin/multi-pack-index.c\n+++ b/builtin/multi-pack-index.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"midx.h\"\ndiff --git a/builtin/pack-refs.c b/builtin/pack-refs.c\nindex e47bae1c803..5e28d0f9e80 100644\n--- a/builtin/pack-refs.c\n+++ b/builtin/pack-refs.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\ndiff --git a/builtin/patch-id.c b/builtin/patch-id.c\nindex a659f00531a..d26e9d0c1ea 100644\n--- a/builtin/patch-id.c\n+++ b/builtin/patch-id.c\n@@ -3,6 +3,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hash.h\"\n #include \"hex.h\"\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex 5ea51c31f58..e6d3535c3b5 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -11,6 +11,7 @@\n #include \"builtin.h\"\n #include \"advice.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"merge.h\"\ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex 00eef756e67..34f7a59f38e 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -6,6 +6,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 3fe39e9df73..19897ef927f 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -11,6 +11,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"editor.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex 8c0da7a3ce7..05d89e98c3c 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -9,6 +9,7 @@\n #include \"builtin.h\"\n #include \"advice.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/send-pack.c b/builtin/send-pack.c\nindex 28b69d26b48..8b81c8a8486 100644\n--- a/builtin/send-pack.c\n+++ b/builtin/send-pack.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"pkt-line.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/show-ref.c b/builtin/show-ref.c\nindex 414e55b92d5..0b6f9edf86c 100644\n--- a/builtin/show-ref.c\n+++ b/builtin/show-ref.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs/refs-internal.h\"\ndiff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c\nindex 5c4623067c5..231e41e715b 100644\n--- a/builtin/symbolic-ref.c\n+++ b/builtin/symbolic-ref.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"refs.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex ae871adc909..87877a9fabc 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"object-file.h\"\n #include \"object-name.h\"\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex cb936643243..195437e7c65 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -3,6 +3,7 @@\n \n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hash.h\"\n #include \"hex.h\"\ndiff --git a/builtin/update-server-info.c b/builtin/update-server-info.c\nindex ba702d30efd..4c12968a836 100644\n--- a/builtin/update-server-info.c\n+++ b/builtin/update-server-info.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"server-info.h\"\ndiff --git a/builtin/var.c b/builtin/var.c\nindex beeac12dccf..a2d790d4532 100644\n--- a/builtin/var.c\n+++ b/builtin/var.c\n@@ -11,6 +11,7 @@\n #include \"attr.h\"\n #include \"config.h\"\n #include \"editor.h\"\n+#include \"environment.h\"\n #include \"ident.h\"\n #include \"pager.h\"\n #include \"refs.h\"\ndiff --git a/builtin/verify-commit.c b/builtin/verify-commit.c\nindex 5f749a30daf..62398acd721 100644\n--- a/builtin/verify-commit.c\n+++ b/builtin/verify-commit.c\n@@ -7,6 +7,7 @@\n  */\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"object-name.h\"\n #include \"commit.h\"\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex d9f66f5e767..65fd6629a00 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex ed1c40338fd..cd6bc11095d 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -7,6 +7,7 @@\n  */\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"tag.h\"\n #include \"object-name.h\"\ndiff --git a/builtin/write-tree.c b/builtin/write-tree.c\nindex 3465c70a48a..e3bd1a40dbf 100644\n--- a/builtin/write-tree.c\n+++ b/builtin/write-tree.c\n@@ -6,6 +6,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\ndiff --git a/commit-graph.c b/commit-graph.c\nindex bd7b6f5338b..e0d92b816f5 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -4,6 +4,7 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"csum-file.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/config.c b/config.c\nindex 285cab0ce2a..947fba3d8d4 100644\n--- a/config.c\n+++ b/config.c\n@@ -6,12 +6,10 @@\n  *\n  */\n \n-#define USE_THE_REPOSITORY_VARIABLE\n #define DISABLE_SIGN_COMPARE_WARNINGS\n \n #include \"git-compat-util.h\"\n #include \"abspath.h\"\n-#include \"advice.h\"\n #include \"date.h\"\n #include \"branch.h\"\n #include \"config.h\"\n@@ -20,11 +18,8 @@\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"git-zlib.h\"\n-#include \"ident.h\"\n #include \"repository.h\"\n #include \"lockfile.h\"\n-#include \"mailmap.h\"\n-#include \"attr.h\"\n #include \"exec-cmd.h\"\n #include \"strbuf.h\"\n #include \"quote.h\"\n@@ -32,7 +27,6 @@\n #include \"string-list.h\"\n #include \"object-name.h\"\n #include \"odb.h\"\n-#include \"pager.h\"\n #include \"path.h\"\n #include \"utf8.h\"\n #include \"color.h\"\n@@ -41,7 +35,6 @@\n #include \"strvec.h\"\n #include \"trace2.h\"\n #include \"wildmatch.h\"\n-#include \"ws.h\"\n #include \"write-or-die.h\"\n \n struct config_source {\n@@ -71,9 +64,6 @@ struct config_source {\n };\n #define CONFIG_SOURCE_INIT { 0 }\n \n-static int pack_compression_seen;\n-static int zlib_compression_seen;\n-\n /*\n  * Config that comes from trusted scopes, namely:\n  * - CONFIG_SCOPE_SYSTEM (e.g. /etc/gitconfig)\n@@ -1262,80 +1252,6 @@ double git_config_double(const char *name, const char *value,\n \treturn ret;\n }\n \n-static const struct fsync_component_name {\n-\tconst char *name;\n-\tenum fsync_component component_bits;\n-} fsync_component_names[] = {\n-\t{ \"loose-object\", FSYNC_COMPONENT_LOOSE_OBJECT },\n-\t{ \"pack\", FSYNC_COMPONENT_PACK },\n-\t{ \"pack-metadata\", FSYNC_COMPONENT_PACK_METADATA },\n-\t{ \"commit-graph\", FSYNC_COMPONENT_COMMIT_GRAPH },\n-\t{ \"index\", FSYNC_COMPONENT_INDEX },\n-\t{ \"objects\", FSYNC_COMPONENTS_OBJECTS },\n-\t{ \"reference\", FSYNC_COMPONENT_REFERENCE },\n-\t{ \"derived-metadata\", FSYNC_COMPONENTS_DERIVED_METADATA },\n-\t{ \"committed\", FSYNC_COMPONENTS_COMMITTED },\n-\t{ \"added\", FSYNC_COMPONENTS_ADDED },\n-\t{ \"all\", FSYNC_COMPONENTS_ALL },\n-};\n-\n-static enum fsync_component parse_fsync_components(const char *var, const char *string)\n-{\n-\tenum fsync_component current = FSYNC_COMPONENTS_PLATFORM_DEFAULT;\n-\tenum fsync_component positive = 0, negative = 0;\n-\n-\twhile (string) {\n-\t\tint i;\n-\t\tsize_t len;\n-\t\tconst char *ep;\n-\t\tint negated = 0;\n-\t\tint found = 0;\n-\n-\t\tstring = string + strspn(string, \", \\t\\n\\r\");\n-\t\tep = strchrnul(string, ',');\n-\t\tlen = ep - string;\n-\t\tif (!strcmp(string, \"none\")) {\n-\t\t\tcurrent = FSYNC_COMPONENT_NONE;\n-\t\t\tgoto next_name;\n-\t\t}\n-\n-\t\tif (*string == '-') {\n-\t\t\tnegated = 1;\n-\t\t\tstring++;\n-\t\t\tlen--;\n-\t\t\tif (!len)\n-\t\t\t\twarning(_(\"invalid value for variable %s\"), var);\n-\t\t}\n-\n-\t\tif (!len)\n-\t\t\tbreak;\n-\n-\t\tfor (i = 0; i < ARRAY_SIZE(fsync_component_names); ++i) {\n-\t\t\tconst struct fsync_component_name *n = &fsync_component_names[i];\n-\n-\t\t\tif (strncmp(n->name, string, len))\n-\t\t\t\tcontinue;\n-\n-\t\t\tfound = 1;\n-\t\t\tif (negated)\n-\t\t\t\tnegative |= n->component_bits;\n-\t\t\telse\n-\t\t\t\tpositive |= n->component_bits;\n-\t\t}\n-\n-\t\tif (!found) {\n-\t\t\tchar *component = xstrndup(string, len);\n-\t\t\twarning(_(\"ignoring unknown core.fsync component '%s'\"), component);\n-\t\t\tfree(component);\n-\t\t}\n-\n-next_name:\n-\t\tstring = ep;\n-\t}\n-\n-\treturn (current & ~negative) | positive;\n-}\n-\n int git_config_bool_or_int(const char *name, const char *value,\n \t\t\t   const struct key_value_info *kvi, int *is_bool)\n {\n@@ -1393,433 +1309,6 @@ int git_config_color(char *dest, const char *var, const char *value)\n \treturn 0;\n }\n \n-static int git_default_core_config(const char *var, const char *value,\n-\t\t\t\t   const struct config_context *ctx, void *cb)\n-{\n-\t/* This needs a better name */\n-\tif (!strcmp(var, \"core.filemode\")) {\n-\t\ttrust_executable_bit = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\tif (!strcmp(var, \"core.trustctime\")) {\n-\t\ttrust_ctime = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\tif (!strcmp(var, \"core.checkstat\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\tif (!strcasecmp(value, \"default\"))\n-\t\t\tcheck_stat = 1;\n-\t\telse if (!strcasecmp(value, \"minimal\"))\n-\t\t\tcheck_stat = 0;\n-\t\telse\n-\t\t\treturn error(_(\"invalid value for '%s': '%s'\"),\n-\t\t\t\t     var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"core.quotepath\")) {\n-\t\tquote_path_fully = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.symlinks\")) {\n-\t\thas_symlinks = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.ignorecase\")) {\n-\t\tignore_case = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.attributesfile\")) {\n-\t\tFREE_AND_NULL(git_attributes_file);\n-\t\treturn git_config_pathname(&git_attributes_file, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"core.bare\")) {\n-\t\tis_bare_repository_cfg = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.ignorestat\")) {\n-\t\tassume_unchanged = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.abbrev\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\tif (!strcasecmp(value, \"auto\"))\n-\t\t\tdefault_abbrev = -1;\n-\t\telse if (!git_parse_maybe_bool_text(value))\n-\t\t\tdefault_abbrev = GIT_MAX_HEXSZ;\n-\t\telse {\n-\t\t\tint abbrev = git_config_int(var, value, ctx->kvi);\n-\t\t\tif (abbrev < minimum_abbrev)\n-\t\t\t\treturn error(_(\"abbrev length out of range: %d\"), abbrev);\n-\t\t\tdefault_abbrev = abbrev;\n-\t\t}\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.disambiguate\"))\n-\t\treturn set_disambiguate_hint_config(var, value);\n-\n-\tif (!strcmp(var, \"core.loosecompression\")) {\n-\t\tint level = git_config_int(var, value, ctx->kvi);\n-\t\tif (level == -1)\n-\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n-\t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n-\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n-\t\tzlib_compression_level = level;\n-\t\tzlib_compression_seen = 1;\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.compression\")) {\n-\t\tint level = git_config_int(var, value, ctx->kvi);\n-\t\tif (level == -1)\n-\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n-\t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n-\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n-\t\tif (!zlib_compression_seen)\n-\t\t\tzlib_compression_level = level;\n-\t\tif (!pack_compression_seen)\n-\t\t\tpack_compression_level = level;\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.autocrlf\")) {\n-\t\tif (value && !strcasecmp(value, \"input\")) {\n-\t\t\tauto_crlf = AUTO_CRLF_INPUT;\n-\t\t\treturn 0;\n-\t\t}\n-\t\tauto_crlf = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.safecrlf\")) {\n-\t\tint eol_rndtrp_die;\n-\t\tif (value && !strcasecmp(value, \"warn\")) {\n-\t\t\tglobal_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n-\t\t\treturn 0;\n-\t\t}\n-\t\teol_rndtrp_die = git_config_bool(var, value);\n-\t\tglobal_conv_flags_eol = eol_rndtrp_die ?\n-\t\t\tCONV_EOL_RNDTRP_DIE : 0;\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.eol\")) {\n-\t\tif (value && !strcasecmp(value, \"lf\"))\n-\t\t\tcore_eol = EOL_LF;\n-\t\telse if (value && !strcasecmp(value, \"crlf\"))\n-\t\t\tcore_eol = EOL_CRLF;\n-\t\telse if (value && !strcasecmp(value, \"native\"))\n-\t\t\tcore_eol = EOL_NATIVE;\n-\t\telse\n-\t\t\tcore_eol = EOL_UNSET;\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.checkroundtripencoding\")) {\n-\t\tFREE_AND_NULL(check_roundtrip_encoding);\n-\t\treturn git_config_string(&check_roundtrip_encoding, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"core.editor\")) {\n-\t\tFREE_AND_NULL(editor_program);\n-\t\treturn git_config_string(&editor_program, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"core.commentchar\") ||\n-\t    !strcmp(var, \"core.commentstring\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\telse if (!strcasecmp(value, \"auto\"))\n-\t\t\tauto_comment_line_char = 1;\n-\t\telse if (value[0]) {\n-\t\t\tif (strchr(value, '\\n'))\n-\t\t\t\treturn error(_(\"%s cannot contain newline\"), var);\n-\t\t\tcomment_line_str = value;\n-\t\t\tFREE_AND_NULL(comment_line_str_to_free);\n-\t\t\tauto_comment_line_char = 0;\n-\t\t} else\n-\t\t\treturn error(_(\"%s must have at least one character\"), var);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.askpass\")) {\n-\t\tFREE_AND_NULL(askpass_program);\n-\t\treturn git_config_string(&askpass_program, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"core.excludesfile\")) {\n-\t\tFREE_AND_NULL(excludes_file);\n-\t\treturn git_config_pathname(&excludes_file, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"core.whitespace\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\twhitespace_rule_cfg = parse_whitespace_rule(value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.fsync\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\tfsync_components = parse_fsync_components(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.fsyncmethod\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\tif (!strcmp(value, \"fsync\"))\n-\t\t\tfsync_method = FSYNC_METHOD_FSYNC;\n-\t\telse if (!strcmp(value, \"writeout-only\"))\n-\t\t\tfsync_method = FSYNC_METHOD_WRITEOUT_ONLY;\n-\t\telse if (!strcmp(value, \"batch\"))\n-\t\t\tfsync_method = FSYNC_METHOD_BATCH;\n-\t\telse\n-\t\t\twarning(_(\"ignoring unknown core.fsyncMethod value '%s'\"), value);\n-\n-\t}\n-\n-\tif (!strcmp(var, \"core.fsyncobjectfiles\")) {\n-\t\tif (fsync_object_files < 0)\n-\t\t\twarning(_(\"core.fsyncObjectFiles is deprecated; use core.fsync instead\"));\n-\t\tfsync_object_files = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.createobject\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\tif (!strcmp(value, \"rename\"))\n-\t\t\tobject_creation_mode = OBJECT_CREATION_USES_RENAMES;\n-\t\telse if (!strcmp(value, \"link\"))\n-\t\t\tobject_creation_mode = OBJECT_CREATION_USES_HARDLINKS;\n-\t\telse\n-\t\t\tdie(_(\"invalid mode for object creation: %s\"), value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.sparsecheckout\")) {\n-\t\tcore_apply_sparse_checkout = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.sparsecheckoutcone\")) {\n-\t\tcore_sparse_checkout_cone = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.precomposeunicode\")) {\n-\t\tprecomposed_unicode = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.protecthfs\")) {\n-\t\tprotect_hfs = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.protectntfs\")) {\n-\t\tprotect_ntfs = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.maxtreedepth\")) {\n-\t\tmax_allowed_tree_depth = git_config_int(var, value, ctx->kvi);\n-\t\treturn 0;\n-\t}\n-\n-\t/* Add other config variables here and to Documentation/config.adoc. */\n-\treturn platform_core_config(var, value, ctx, cb);\n-}\n-\n-static int git_default_sparse_config(const char *var, const char *value)\n-{\n-\tif (!strcmp(var, \"sparse.expectfilesoutsideofpatterns\")) {\n-\t\tsparse_expect_files_outside_of_patterns = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\t/* Add other config variables here and to Documentation/config/sparse.adoc. */\n-\treturn 0;\n-}\n-\n-static int git_default_i18n_config(const char *var, const char *value)\n-{\n-\tif (!strcmp(var, \"i18n.commitencoding\")) {\n-\t\tFREE_AND_NULL(git_commit_encoding);\n-\t\treturn git_config_string(&git_commit_encoding, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"i18n.logoutputencoding\")) {\n-\t\tFREE_AND_NULL(git_log_output_encoding);\n-\t\treturn git_config_string(&git_log_output_encoding, var, value);\n-\t}\n-\n-\t/* Add other config variables here and to Documentation/config.adoc. */\n-\treturn 0;\n-}\n-\n-static int git_default_branch_config(const char *var, const char *value)\n-{\n-\tif (!strcmp(var, \"branch.autosetupmerge\")) {\n-\t\tif (value && !strcmp(value, \"always\")) {\n-\t\t\tgit_branch_track = BRANCH_TRACK_ALWAYS;\n-\t\t\treturn 0;\n-\t\t} else if (value && !strcmp(value, \"inherit\")) {\n-\t\t\tgit_branch_track = BRANCH_TRACK_INHERIT;\n-\t\t\treturn 0;\n-\t\t} else if (value && !strcmp(value, \"simple\")) {\n-\t\t\tgit_branch_track = BRANCH_TRACK_SIMPLE;\n-\t\t\treturn 0;\n-\t\t}\n-\t\tgit_branch_track = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\tif (!strcmp(var, \"branch.autosetuprebase\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\telse if (!strcmp(value, \"never\"))\n-\t\t\tautorebase = AUTOREBASE_NEVER;\n-\t\telse if (!strcmp(value, \"local\"))\n-\t\t\tautorebase = AUTOREBASE_LOCAL;\n-\t\telse if (!strcmp(value, \"remote\"))\n-\t\t\tautorebase = AUTOREBASE_REMOTE;\n-\t\telse if (!strcmp(value, \"always\"))\n-\t\t\tautorebase = AUTOREBASE_ALWAYS;\n-\t\telse\n-\t\t\treturn error(_(\"malformed value for %s\"), var);\n-\t\treturn 0;\n-\t}\n-\n-\t/* Add other config variables here and to Documentation/config.adoc. */\n-\treturn 0;\n-}\n-\n-static int git_default_push_config(const char *var, const char *value)\n-{\n-\tif (!strcmp(var, \"push.default\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\telse if (!strcmp(value, \"nothing\"))\n-\t\t\tpush_default = PUSH_DEFAULT_NOTHING;\n-\t\telse if (!strcmp(value, \"matching\"))\n-\t\t\tpush_default = PUSH_DEFAULT_MATCHING;\n-\t\telse if (!strcmp(value, \"simple\"))\n-\t\t\tpush_default = PUSH_DEFAULT_SIMPLE;\n-\t\telse if (!strcmp(value, \"upstream\"))\n-\t\t\tpush_default = PUSH_DEFAULT_UPSTREAM;\n-\t\telse if (!strcmp(value, \"tracking\")) /* deprecated */\n-\t\t\tpush_default = PUSH_DEFAULT_UPSTREAM;\n-\t\telse if (!strcmp(value, \"current\"))\n-\t\t\tpush_default = PUSH_DEFAULT_CURRENT;\n-\t\telse {\n-\t\t\terror(_(\"malformed value for %s: %s\"), var, value);\n-\t\t\treturn error(_(\"must be one of nothing, matching, simple, \"\n-\t\t\t\t       \"upstream or current\"));\n-\t\t}\n-\t\treturn 0;\n-\t}\n-\n-\t/* Add other config variables here and to Documentation/config.adoc. */\n-\treturn 0;\n-}\n-\n-static int git_default_mailmap_config(const char *var, const char *value)\n-{\n-\tif (!strcmp(var, \"mailmap.file\")) {\n-\t\tFREE_AND_NULL(git_mailmap_file);\n-\t\treturn git_config_pathname(&git_mailmap_file, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"mailmap.blob\")) {\n-\t\tFREE_AND_NULL(git_mailmap_blob);\n-\t\treturn git_config_string(&git_mailmap_blob, var, value);\n-\t}\n-\n-\t/* Add other config variables here and to Documentation/config.adoc. */\n-\treturn 0;\n-}\n-\n-static int git_default_attr_config(const char *var, const char *value)\n-{\n-\tif (!strcmp(var, \"attr.tree\")) {\n-\t\tFREE_AND_NULL(git_attr_tree);\n-\t\treturn git_config_string(&git_attr_tree, var, value);\n-\t}\n-\n-\t/*\n-\t * Add other attribute related config variables here and to\n-\t * Documentation/config/attr.adoc.\n-\t */\n-\treturn 0;\n-}\n-\n-int git_default_config(const char *var, const char *value,\n-\t\t       const struct config_context *ctx, void *cb)\n-{\n-\tif (starts_with(var, \"core.\"))\n-\t\treturn git_default_core_config(var, value, ctx, cb);\n-\n-\tif (starts_with(var, \"user.\") ||\n-\t    starts_with(var, \"author.\") ||\n-\t    starts_with(var, \"committer.\"))\n-\t\treturn git_ident_config(var, value, ctx, cb);\n-\n-\tif (starts_with(var, \"i18n.\"))\n-\t\treturn git_default_i18n_config(var, value);\n-\n-\tif (starts_with(var, \"branch.\"))\n-\t\treturn git_default_branch_config(var, value);\n-\n-\tif (starts_with(var, \"push.\"))\n-\t\treturn git_default_push_config(var, value);\n-\n-\tif (starts_with(var, \"mailmap.\"))\n-\t\treturn git_default_mailmap_config(var, value);\n-\n-\tif (starts_with(var, \"attr.\"))\n-\t\treturn git_default_attr_config(var, value);\n-\n-\tif (starts_with(var, \"advice.\") || starts_with(var, \"color.advice\"))\n-\t\treturn git_default_advice_config(var, value);\n-\n-\tif (!strcmp(var, \"pager.color\") || !strcmp(var, \"color.pager\")) {\n-\t\tpager_use_color = git_config_bool(var,value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"pack.packsizelimit\")) {\n-\t\tpack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"pack.compression\")) {\n-\t\tint level = git_config_int(var, value, ctx->kvi);\n-\t\tif (level == -1)\n-\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n-\t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n-\t\t\tdie(_(\"bad pack compression level %d\"), level);\n-\t\tpack_compression_level = level;\n-\t\tpack_compression_seen = 1;\n-\t\treturn 0;\n-\t}\n-\n-\tif (starts_with(var, \"sparse.\"))\n-\t\treturn git_default_sparse_config(var, value);\n-\n-\t/* Add other config variables here and to Documentation/config.adoc. */\n-\treturn 0;\n-}\n-\n /*\n  * All source specific fields in the union, die_on_error, name and the callbacks\n  * fgetc, ungetc, ftell of top need to be initialized before calling\ndiff --git a/config.h b/config.h\nindex 87baf8eeffe..65fc47966e6 100644\n--- a/config.h\n+++ b/config.h\n@@ -165,9 +165,6 @@ struct config_context {\n typedef int (*config_fn_t)(const char *, const char *,\n \t\t\t   const struct config_context *, void *);\n \n-int git_default_config(const char *, const char *,\n-\t\t       const struct config_context *, void *);\n-\n /**\n  * Read a specific file in git-config format.\n  * This function takes the same callback and data parameters as `repo_config`.\ndiff --git a/environment.c b/environment.c\nindex 7c2480b22e5..ae1427bb9e8 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -12,22 +12,34 @@\n \n #include \"git-compat-util.h\"\n #include \"abspath.h\"\n+#include \"advice.h\"\n+#include \"attr.h\"\n #include \"branch.h\"\n+#include \"color.h\"\n #include \"convert.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"git-zlib.h\"\n+#include \"ident.h\"\n+#include \"mailmap.h\"\n+#include \"object-name.h\"\n #include \"repository.h\"\n #include \"config.h\"\n #include \"refs.h\"\n #include \"fmt-merge-msg.h\"\n #include \"commit.h\"\n #include \"strvec.h\"\n+#include \"pager.h\"\n #include \"path.h\"\n+#include \"quote.h\"\n #include \"chdir-notify.h\"\n #include \"setup.h\"\n+#include \"ws.h\"\n #include \"write-or-die.h\"\n \n+static int pack_compression_seen;\n+static int zlib_compression_seen;\n+\n int trust_executable_bit = 1;\n int trust_ctime = 1;\n int check_stat = 1;\n@@ -231,3 +243,503 @@ int print_sha1_ellipsis(void)\n \t}\n \treturn cached_result;\n }\n+\n+static const struct fsync_component_name {\n+\tconst char *name;\n+\tenum fsync_component component_bits;\n+} fsync_component_names[] = {\n+\t{ \"loose-object\", FSYNC_COMPONENT_LOOSE_OBJECT },\n+\t{ \"pack\", FSYNC_COMPONENT_PACK },\n+\t{ \"pack-metadata\", FSYNC_COMPONENT_PACK_METADATA },\n+\t{ \"commit-graph\", FSYNC_COMPONENT_COMMIT_GRAPH },\n+\t{ \"index\", FSYNC_COMPONENT_INDEX },\n+\t{ \"objects\", FSYNC_COMPONENTS_OBJECTS },\n+\t{ \"reference\", FSYNC_COMPONENT_REFERENCE },\n+\t{ \"derived-metadata\", FSYNC_COMPONENTS_DERIVED_METADATA },\n+\t{ \"committed\", FSYNC_COMPONENTS_COMMITTED },\n+\t{ \"added\", FSYNC_COMPONENTS_ADDED },\n+\t{ \"all\", FSYNC_COMPONENTS_ALL },\n+};\n+\n+static enum fsync_component parse_fsync_components(const char *var, const char *string)\n+{\n+\tenum fsync_component current = FSYNC_COMPONENTS_PLATFORM_DEFAULT;\n+\tenum fsync_component positive = 0, negative = 0;\n+\n+\twhile (string) {\n+\t\tsize_t len;\n+\t\tconst char *ep;\n+\t\tint negated = 0;\n+\t\tint found = 0;\n+\n+\t\tstring = string + strspn(string, \", \\t\\n\\r\");\n+\t\tep = strchrnul(string, ',');\n+\t\tlen = ep - string;\n+\t\tif (!strcmp(string, \"none\")) {\n+\t\t\tcurrent = FSYNC_COMPONENT_NONE;\n+\t\t\tgoto next_name;\n+\t\t}\n+\n+\t\tif (*string == '-') {\n+\t\t\tnegated = 1;\n+\t\t\tstring++;\n+\t\t\tlen--;\n+\t\t\tif (!len)\n+\t\t\t\twarning(_(\"invalid value for variable %s\"), var);\n+\t\t}\n+\n+\t\tif (!len)\n+\t\t\tbreak;\n+\n+\t\tfor (size_t i = 0; i < ARRAY_SIZE(fsync_component_names); ++i) {\n+\t\t\tconst struct fsync_component_name *n = &fsync_component_names[i];\n+\n+\t\t\tif (strncmp(n->name, string, len))\n+\t\t\t\tcontinue;\n+\n+\t\t\tfound = 1;\n+\t\t\tif (negated)\n+\t\t\t\tnegative |= n->component_bits;\n+\t\t\telse\n+\t\t\t\tpositive |= n->component_bits;\n+\t\t}\n+\n+\t\tif (!found) {\n+\t\t\tchar *component = xstrndup(string, len);\n+\t\t\twarning(_(\"ignoring unknown core.fsync component '%s'\"), component);\n+\t\t\tfree(component);\n+\t\t}\n+\n+next_name:\n+\t\tstring = ep;\n+\t}\n+\n+\treturn (current & ~negative) | positive;\n+}\n+\n+static int git_default_core_config(const char *var, const char *value,\n+\t\t\t\t   const struct config_context *ctx, void *cb)\n+{\n+\t/* This needs a better name */\n+\tif (!strcmp(var, \"core.filemode\")) {\n+\t\ttrust_executable_bit = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\tif (!strcmp(var, \"core.trustctime\")) {\n+\t\ttrust_ctime = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\tif (!strcmp(var, \"core.checkstat\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\tif (!strcasecmp(value, \"default\"))\n+\t\t\tcheck_stat = 1;\n+\t\telse if (!strcasecmp(value, \"minimal\"))\n+\t\t\tcheck_stat = 0;\n+\t\telse\n+\t\t\treturn error(_(\"invalid value for '%s': '%s'\"),\n+\t\t\t\t     var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"core.quotepath\")) {\n+\t\tquote_path_fully = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.symlinks\")) {\n+\t\thas_symlinks = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.ignorecase\")) {\n+\t\tignore_case = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.attributesfile\")) {\n+\t\tFREE_AND_NULL(git_attributes_file);\n+\t\treturn git_config_pathname(&git_attributes_file, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"core.bare\")) {\n+\t\tis_bare_repository_cfg = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.ignorestat\")) {\n+\t\tassume_unchanged = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.abbrev\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\tif (!strcasecmp(value, \"auto\"))\n+\t\t\tdefault_abbrev = -1;\n+\t\telse if (!git_parse_maybe_bool_text(value))\n+\t\t\tdefault_abbrev = GIT_MAX_HEXSZ;\n+\t\telse {\n+\t\t\tint abbrev = git_config_int(var, value, ctx->kvi);\n+\t\t\tif (abbrev < minimum_abbrev)\n+\t\t\t\treturn error(_(\"abbrev length out of range: %d\"), abbrev);\n+\t\t\tdefault_abbrev = abbrev;\n+\t\t}\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.disambiguate\"))\n+\t\treturn set_disambiguate_hint_config(var, value);\n+\n+\tif (!strcmp(var, \"core.loosecompression\")) {\n+\t\tint level = git_config_int(var, value, ctx->kvi);\n+\t\tif (level == -1)\n+\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n+\t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n+\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n+\t\tzlib_compression_level = level;\n+\t\tzlib_compression_seen = 1;\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.compression\")) {\n+\t\tint level = git_config_int(var, value, ctx->kvi);\n+\t\tif (level == -1)\n+\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n+\t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n+\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n+\t\tif (!zlib_compression_seen)\n+\t\t\tzlib_compression_level = level;\n+\t\tif (!pack_compression_seen)\n+\t\t\tpack_compression_level = level;\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.autocrlf\")) {\n+\t\tif (value && !strcasecmp(value, \"input\")) {\n+\t\t\tauto_crlf = AUTO_CRLF_INPUT;\n+\t\t\treturn 0;\n+\t\t}\n+\t\tauto_crlf = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.safecrlf\")) {\n+\t\tint eol_rndtrp_die;\n+\t\tif (value && !strcasecmp(value, \"warn\")) {\n+\t\t\tglobal_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n+\t\t\treturn 0;\n+\t\t}\n+\t\teol_rndtrp_die = git_config_bool(var, value);\n+\t\tglobal_conv_flags_eol = eol_rndtrp_die ?\n+\t\t\tCONV_EOL_RNDTRP_DIE : 0;\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.eol\")) {\n+\t\tif (value && !strcasecmp(value, \"lf\"))\n+\t\t\tcore_eol = EOL_LF;\n+\t\telse if (value && !strcasecmp(value, \"crlf\"))\n+\t\t\tcore_eol = EOL_CRLF;\n+\t\telse if (value && !strcasecmp(value, \"native\"))\n+\t\t\tcore_eol = EOL_NATIVE;\n+\t\telse\n+\t\t\tcore_eol = EOL_UNSET;\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.checkroundtripencoding\")) {\n+\t\tFREE_AND_NULL(check_roundtrip_encoding);\n+\t\treturn git_config_string(&check_roundtrip_encoding, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"core.editor\")) {\n+\t\tFREE_AND_NULL(editor_program);\n+\t\treturn git_config_string(&editor_program, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"core.commentchar\") ||\n+\t    !strcmp(var, \"core.commentstring\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\telse if (!strcasecmp(value, \"auto\"))\n+\t\t\tauto_comment_line_char = 1;\n+\t\telse if (value[0]) {\n+\t\t\tif (strchr(value, '\\n'))\n+\t\t\t\treturn error(_(\"%s cannot contain newline\"), var);\n+\t\t\tcomment_line_str = value;\n+\t\t\tFREE_AND_NULL(comment_line_str_to_free);\n+\t\t\tauto_comment_line_char = 0;\n+\t\t} else\n+\t\t\treturn error(_(\"%s must have at least one character\"), var);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.askpass\")) {\n+\t\tFREE_AND_NULL(askpass_program);\n+\t\treturn git_config_string(&askpass_program, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"core.excludesfile\")) {\n+\t\tFREE_AND_NULL(excludes_file);\n+\t\treturn git_config_pathname(&excludes_file, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"core.whitespace\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\twhitespace_rule_cfg = parse_whitespace_rule(value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.fsync\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\tfsync_components = parse_fsync_components(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.fsyncmethod\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\tif (!strcmp(value, \"fsync\"))\n+\t\t\tfsync_method = FSYNC_METHOD_FSYNC;\n+\t\telse if (!strcmp(value, \"writeout-only\"))\n+\t\t\tfsync_method = FSYNC_METHOD_WRITEOUT_ONLY;\n+\t\telse if (!strcmp(value, \"batch\"))\n+\t\t\tfsync_method = FSYNC_METHOD_BATCH;\n+\t\telse\n+\t\t\twarning(_(\"ignoring unknown core.fsyncMethod value '%s'\"), value);\n+\n+\t}\n+\n+\tif (!strcmp(var, \"core.fsyncobjectfiles\")) {\n+\t\tif (fsync_object_files < 0)\n+\t\t\twarning(_(\"core.fsyncObjectFiles is deprecated; use core.fsync instead\"));\n+\t\tfsync_object_files = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.createobject\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\tif (!strcmp(value, \"rename\"))\n+\t\t\tobject_creation_mode = OBJECT_CREATION_USES_RENAMES;\n+\t\telse if (!strcmp(value, \"link\"))\n+\t\t\tobject_creation_mode = OBJECT_CREATION_USES_HARDLINKS;\n+\t\telse\n+\t\t\tdie(_(\"invalid mode for object creation: %s\"), value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.sparsecheckout\")) {\n+\t\tcore_apply_sparse_checkout = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.sparsecheckoutcone\")) {\n+\t\tcore_sparse_checkout_cone = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.precomposeunicode\")) {\n+\t\tprecomposed_unicode = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.protecthfs\")) {\n+\t\tprotect_hfs = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.protectntfs\")) {\n+\t\tprotect_ntfs = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.maxtreedepth\")) {\n+\t\tmax_allowed_tree_depth = git_config_int(var, value, ctx->kvi);\n+\t\treturn 0;\n+\t}\n+\n+\t/* Add other config variables here and to Documentation/config.adoc. */\n+\treturn platform_core_config(var, value, ctx, cb);\n+}\n+\n+static int git_default_sparse_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"sparse.expectfilesoutsideofpatterns\")) {\n+\t\tsparse_expect_files_outside_of_patterns = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\t/* Add other config variables here and to Documentation/config/sparse.adoc. */\n+\treturn 0;\n+}\n+\n+static int git_default_i18n_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"i18n.commitencoding\")) {\n+\t\tFREE_AND_NULL(git_commit_encoding);\n+\t\treturn git_config_string(&git_commit_encoding, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"i18n.logoutputencoding\")) {\n+\t\tFREE_AND_NULL(git_log_output_encoding);\n+\t\treturn git_config_string(&git_log_output_encoding, var, value);\n+\t}\n+\n+\t/* Add other config variables here and to Documentation/config.adoc. */\n+\treturn 0;\n+}\n+\n+static int git_default_branch_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"branch.autosetupmerge\")) {\n+\t\tif (value && !strcmp(value, \"always\")) {\n+\t\t\tgit_branch_track = BRANCH_TRACK_ALWAYS;\n+\t\t\treturn 0;\n+\t\t} else if (value && !strcmp(value, \"inherit\")) {\n+\t\t\tgit_branch_track = BRANCH_TRACK_INHERIT;\n+\t\t\treturn 0;\n+\t\t} else if (value && !strcmp(value, \"simple\")) {\n+\t\t\tgit_branch_track = BRANCH_TRACK_SIMPLE;\n+\t\t\treturn 0;\n+\t\t}\n+\t\tgit_branch_track = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\tif (!strcmp(var, \"branch.autosetuprebase\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\telse if (!strcmp(value, \"never\"))\n+\t\t\tautorebase = AUTOREBASE_NEVER;\n+\t\telse if (!strcmp(value, \"local\"))\n+\t\t\tautorebase = AUTOREBASE_LOCAL;\n+\t\telse if (!strcmp(value, \"remote\"))\n+\t\t\tautorebase = AUTOREBASE_REMOTE;\n+\t\telse if (!strcmp(value, \"always\"))\n+\t\t\tautorebase = AUTOREBASE_ALWAYS;\n+\t\telse\n+\t\t\treturn error(_(\"malformed value for %s\"), var);\n+\t\treturn 0;\n+\t}\n+\n+\t/* Add other config variables here and to Documentation/config.adoc. */\n+\treturn 0;\n+}\n+\n+static int git_default_push_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"push.default\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\telse if (!strcmp(value, \"nothing\"))\n+\t\t\tpush_default = PUSH_DEFAULT_NOTHING;\n+\t\telse if (!strcmp(value, \"matching\"))\n+\t\t\tpush_default = PUSH_DEFAULT_MATCHING;\n+\t\telse if (!strcmp(value, \"simple\"))\n+\t\t\tpush_default = PUSH_DEFAULT_SIMPLE;\n+\t\telse if (!strcmp(value, \"upstream\"))\n+\t\t\tpush_default = PUSH_DEFAULT_UPSTREAM;\n+\t\telse if (!strcmp(value, \"tracking\")) /* deprecated */\n+\t\t\tpush_default = PUSH_DEFAULT_UPSTREAM;\n+\t\telse if (!strcmp(value, \"current\"))\n+\t\t\tpush_default = PUSH_DEFAULT_CURRENT;\n+\t\telse {\n+\t\t\terror(_(\"malformed value for %s: %s\"), var, value);\n+\t\t\treturn error(_(\"must be one of nothing, matching, simple, \"\n+\t\t\t\t       \"upstream or current\"));\n+\t\t}\n+\t\treturn 0;\n+\t}\n+\n+\t/* Add other config variables here and to Documentation/config.adoc. */\n+\treturn 0;\n+}\n+\n+static int git_default_mailmap_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"mailmap.file\")) {\n+\t\tFREE_AND_NULL(git_mailmap_file);\n+\t\treturn git_config_pathname(&git_mailmap_file, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"mailmap.blob\")) {\n+\t\tFREE_AND_NULL(git_mailmap_blob);\n+\t\treturn git_config_string(&git_mailmap_blob, var, value);\n+\t}\n+\n+\t/* Add other config variables here and to Documentation/config.adoc. */\n+\treturn 0;\n+}\n+\n+static int git_default_attr_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"attr.tree\")) {\n+\t\tFREE_AND_NULL(git_attr_tree);\n+\t\treturn git_config_string(&git_attr_tree, var, value);\n+\t}\n+\n+\t/*\n+\t * Add other attribute related config variables here and to\n+\t * Documentation/config/attr.adoc.\n+\t */\n+\treturn 0;\n+}\n+\n+int git_default_config(const char *var, const char *value,\n+\t\t       const struct config_context *ctx, void *cb)\n+{\n+\tif (starts_with(var, \"core.\"))\n+\t\treturn git_default_core_config(var, value, ctx, cb);\n+\n+\tif (starts_with(var, \"user.\") ||\n+\t    starts_with(var, \"author.\") ||\n+\t    starts_with(var, \"committer.\"))\n+\t\treturn git_ident_config(var, value, ctx, cb);\n+\n+\tif (starts_with(var, \"i18n.\"))\n+\t\treturn git_default_i18n_config(var, value);\n+\n+\tif (starts_with(var, \"branch.\"))\n+\t\treturn git_default_branch_config(var, value);\n+\n+\tif (starts_with(var, \"push.\"))\n+\t\treturn git_default_push_config(var, value);\n+\n+\tif (starts_with(var, \"mailmap.\"))\n+\t\treturn git_default_mailmap_config(var, value);\n+\n+\tif (starts_with(var, \"attr.\"))\n+\t\treturn git_default_attr_config(var, value);\n+\n+\tif (starts_with(var, \"advice.\") || starts_with(var, \"color.advice\"))\n+\t\treturn git_default_advice_config(var, value);\n+\n+\tif (!strcmp(var, \"pager.color\") || !strcmp(var, \"color.pager\")) {\n+\t\tpager_use_color = git_config_bool(var,value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"pack.packsizelimit\")) {\n+\t\tpack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"pack.compression\")) {\n+\t\tint level = git_config_int(var, value, ctx->kvi);\n+\t\tif (level == -1)\n+\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n+\t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n+\t\t\tdie(_(\"bad pack compression level %d\"), level);\n+\t\tpack_compression_level = level;\n+\t\tpack_compression_seen = 1;\n+\t\treturn 0;\n+\t}\n+\n+\tif (starts_with(var, \"sparse.\"))\n+\t\treturn git_default_sparse_config(var, value);\n+\n+\t/* Add other config variables here and to Documentation/config.adoc. */\n+\treturn 0;\n+}\ndiff --git a/environment.h b/environment.h\nindex 3d806ced6e4..8cfce41015b 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -104,6 +104,9 @@ int use_optional_locks(void);\n const char *get_git_namespace(void);\n const char *strip_namespace(const char *namespaced_ref);\n \n+int git_default_config(const char *, const char *,\n+\t\t       const struct config_context *, void *);\n+\n /*\n  * TODO: All the below state either explicitly or implicitly relies on\n  * `the_repository`. We should eventually get rid of these and make the\ndiff --git a/fsck.c b/fsck.c\nindex 23965e1880f..171b424dd57 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -3,6 +3,7 @@\n #include \"git-compat-util.h\"\n #include \"date.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"odb.h\"\n #include \"path.h\"\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 17b9fe4ff8c..1922e23fcd3 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -2,6 +2,7 @@\n \n #include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"http.h\"\ndiff --git a/http.c b/http.c\nindex d94e8f63b57..33ae9429fd8 100644\n--- a/http.c\n+++ b/http.c\n@@ -3,6 +3,7 @@\n \n #include \"git-compat-util.h\"\n #include \"git-curl-compat.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"http.h\"\n #include \"config.h\"\ndiff --git a/imap-send.c b/imap-send.c\nindex 9b26c669c01..254ec83ab78 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -28,6 +28,7 @@\n #include \"advice.h\"\n #include \"config.h\"\n #include \"credential.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\ndiff --git a/mailinfo.c b/mailinfo.c\nindex b4e815b2d8b..99ac596e096 100644\n--- a/mailinfo.c\n+++ b/mailinfo.c\n@@ -2,6 +2,7 @@\n \n #include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex-ll.h\"\n #include \"utf8.h\"\ndiff --git a/reflog.c b/reflog.c\nindex 39c205fd26e..a9740051346 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -3,6 +3,7 @@\n \n #include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"odb.h\"\ndiff --git a/rerere.c b/rerere.c\nindex c7c3e535ce5..6ec55964e2a 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -5,6 +5,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"copy.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/t/helper/test-advise.c b/t/helper/test-advise.c\nindex 77c15a46cfa..81ed93a05c9 100644\n--- a/t/helper/test-advise.c\n+++ b/t/helper/test-advise.c\n@@ -3,6 +3,7 @@\n #include \"test-tool.h\"\n #include \"advice.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"setup.h\"\n \n int cmd__advise_if_enabled(int argc, const char **argv)\ndiff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c\nindex b2da48eda05..9ae71cefb30 100644\n--- a/t/helper/test-read-cache.c\n+++ b/t/helper/test-read-cache.c\n@@ -2,6 +2,7 @@\n \n #include \"test-tool.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"read-cache-ll.h\"\n #include \"repository.h\"\n #include \"setup.h\"\ndiff --git a/xdiff-interface.c b/xdiff-interface.c\nindex 0e5d38c9600..4971f722b3e 100644\n--- a/xdiff-interface.c\n+++ b/xdiff-interface.c\n@@ -2,6 +2,7 @@\n #define DISABLE_SIGN_COMPARE_WARNINGS\n \n #include \"git-compat-util.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"config.h\"\n #include \"hex.h\"\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522204","messageId":"20250717-pks-config-wo-the-repository-v1-21-d888e4a17de1@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH 21/21] config: fix sign comparison warnings","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-17T10:49:41Z","receivedAt":"2025-07-17T10:50:37Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"There are a couple of -Wsign-compare warnings in \"config.c\":\n\n  - `prepare_include_condition_pattern()` is declared to return a signed\n    int, but it either returns 0 or the index of the last dir separator\n    in a path. That index will always be positive, so the return type of\n    the function is changed to `size_t`, which allows us to drop a check\n    for `prefix < 0` at the only callsite. Furthermore, this fixes a\n    sign comparison warning when comparing `text.len < prefix`,\n\n  - We treat `struct config_store_data::seen` as signed integer in\n    several places even though it's unsigned.\n\n  - There are multiple trivial sign comparison warnings where we use a\n    signed loop index to iterate through an unsigned number of items.\n\nFix all of these issues and drop the `DISABLE_SIGN_COMPARE_WARNINGS`\nmacro.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n config.c | 33 +++++++++++++++------------------\n 1 file changed, 15 insertions(+), 18 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex 947fba3d8d4..a530c48a048 100644\n--- a/config.c\n+++ b/config.c\n@@ -6,8 +6,6 @@\n  *\n  */\n \n-#define DISABLE_SIGN_COMPARE_WARNINGS\n-\n #include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"date.h\"\n@@ -197,12 +195,12 @@ static void add_trailing_starstar_for_dir(struct strbuf *pat)\n \t\tstrbuf_addstr(pat, \"**\");\n }\n \n-static int prepare_include_condition_pattern(const struct key_value_info *kvi,\n-\t\t\t\t\t     struct strbuf *pat)\n+static size_t prepare_include_condition_pattern(const struct key_value_info *kvi,\n+\t\t\t\t\t\tstruct strbuf *pat)\n {\n \tstruct strbuf path = STRBUF_INIT;\n \tchar *expanded;\n-\tint prefix = 0;\n+\tsize_t prefix = 0;\n \n \texpanded = interpolate_path(pat->buf, 1);\n \tif (expanded) {\n@@ -239,7 +237,8 @@ static int include_by_gitdir(const struct key_value_info *kvi,\n {\n \tstruct strbuf text = STRBUF_INIT;\n \tstruct strbuf pattern = STRBUF_INIT;\n-\tint ret = 0, prefix;\n+\tsize_t prefix;\n+\tint ret = 0;\n \tconst char *git_dir;\n \tint already_tried_absolute = 0;\n \n@@ -253,9 +252,6 @@ static int include_by_gitdir(const struct key_value_info *kvi,\n \tprefix = prepare_include_condition_pattern(kvi, &pattern);\n \n again:\n-\tif (prefix < 0)\n-\t\tgoto done;\n-\n \tif (prefix > 0) {\n \t\t/*\n \t\t * perform literal matching on the prefix part so that\n@@ -724,7 +720,6 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n \tif (env) {\n \t\tunsigned long count;\n \t\tchar *endp;\n-\t\tint i;\n \n \t\tcount = strtoul(env, &endp, 10);\n \t\tif (*endp) {\n@@ -736,10 +731,10 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n \t\t\tgoto out;\n \t\t}\n \n-\t\tfor (i = 0; i < count; i++) {\n+\t\tfor (unsigned long i = 0; i < count; i++) {\n \t\t\tconst char *key, *value;\n \n-\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_KEY_%d\", i);\n+\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_KEY_%lu\", i);\n \t\t\tkey = getenv_safe(&to_free, envvar.buf);\n \t\t\tif (!key) {\n \t\t\t\tret = error(_(\"missing config key %s\"), envvar.buf);\n@@ -747,7 +742,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n \t\t\t}\n \t\t\tstrbuf_reset(&envvar);\n \n-\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_VALUE_%d\", i);\n+\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_VALUE_%lu\", i);\n \t\t\tvalue = getenv_safe(&to_free, envvar.buf);\n \t\t\tif (!value) {\n \t\t\t\tret = error(_(\"missing config value %s\"), envvar.buf);\n@@ -1614,13 +1609,13 @@ int config_with_options(config_fn_t fn, void *data,\n \n static void configset_iter(struct config_set *set, config_fn_t fn, void *data)\n {\n-\tint i, value_index;\n+\tint value_index;\n \tstruct string_list *values;\n \tstruct config_set_element *entry;\n \tstruct configset_list *list = &set->list;\n \tstruct config_context ctx = CONFIG_CONTEXT_INIT;\n \n-\tfor (i = 0; i < list->nr; i++) {\n+\tfor (size_t i = 0; i < list->nr; i++) {\n \t\tentry = list->items[i].e;\n \t\tvalue_index = list->items[i].value_index;\n \t\tvalues = &entry->value_list;\n@@ -2470,10 +2465,11 @@ static ssize_t write_pair(int fd, const char *key, const char *value,\n  */\n static void maybe_remove_section(struct config_store_data *store,\n \t\t\t\t size_t *begin_offset, size_t *end_offset,\n-\t\t\t\t int *seen_ptr)\n+\t\t\t\t unsigned *seen_ptr)\n {\n \tsize_t begin;\n-\tint i, seen, section_seen = 0;\n+\tint section_seen = 0;\n+\tunsigned int i, seen;\n \n \t/*\n \t * First, ensure that this is the first key, and that there are no\n@@ -2716,7 +2712,8 @@ int repo_config_set_multivar_in_file_gently(struct repository *r,\n \t} else {\n \t\tstruct stat st;\n \t\tsize_t copy_begin, copy_end;\n-\t\tint i, new_line = 0;\n+\t\tunsigned i;\n+\t\tint new_line = 0;\n \t\tstruct config_options opts;\n \n \t\tif (!value_pattern)\n\n-- \n2.50.1.465.gcb3da1c9e6.dirty\n\n"},{"id":"522538","messageId":"2b914b60-3417-4a49-b545-3109c9a05257@gmail.com","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-21-d888e4a17de1@pks.im","subject":"Re: [PATCH 21/21] config: fix sign comparison warnings","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-23T09:38:16Z","receivedAt":"2025-07-23T09:38:20Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Patrick\n\nOn 17/07/2025 11:49, Patrick Steinhardt wrote:\n> There are a couple of -Wsign-compare warnings in \"config.c\":\n> \n>    - `prepare_include_condition_pattern()` is declared to return a signed\n>      int, but it either returns 0 or the index of the last dir separator\n>      in a path.\n\nThat is not correct, the function contains the lines\n\n               if (!kvi || !kvi->path)\n                         return error(_(\"relative config include \"\n                                        \"conditionals must come from \nfiles\"));\n\nso a negative return value is possible.\n\nThanks\n\nPhillip\n\n>      That index will always be positive, so the return type of\n>      the function is changed to `size_t`, which allows us to drop a check\n>      for `prefix < 0` at the only callsite. Furthermore, this fixes a\n>      sign comparison warning when comparing `text.len < prefix`,\n> \n>    - We treat `struct config_store_data::seen` as signed integer in\n>      several places even though it's unsigned.\n> \n>    - There are multiple trivial sign comparison warnings where we use a\n>      signed loop index to iterate through an unsigned number of items.\n> \n> Fix all of these issues and drop the `DISABLE_SIGN_COMPARE_WARNINGS`\n> macro.\n> \n> Signed-off-by: Patrick Steinhardt <ps@pks.im>\n> ---\n>   config.c | 33 +++++++++++++++------------------\n>   1 file changed, 15 insertions(+), 18 deletions(-)\n> \n> diff --git a/config.c b/config.c\n> index 947fba3d8d4..a530c48a048 100644\n> --- a/config.c\n> +++ b/config.c\n> @@ -6,8 +6,6 @@\n>    *\n>    */\n>   \n> -#define DISABLE_SIGN_COMPARE_WARNINGS\n> -\n>   #include \"git-compat-util.h\"\n>   #include \"abspath.h\"\n>   #include \"date.h\"\n> @@ -197,12 +195,12 @@ static void add_trailing_starstar_for_dir(struct strbuf *pat)\n>   \t\tstrbuf_addstr(pat, \"**\");\n>   }\n>   \n> -static int prepare_include_condition_pattern(const struct key_value_info *kvi,\n> -\t\t\t\t\t     struct strbuf *pat)\n> +static size_t prepare_include_condition_pattern(const struct key_value_info *kvi,\n> +\t\t\t\t\t\tstruct strbuf *pat)\n>   {\n>   \tstruct strbuf path = STRBUF_INIT;\n>   \tchar *expanded;\n> -\tint prefix = 0;\n> +\tsize_t prefix = 0;\n>   \n>   \texpanded = interpolate_path(pat->buf, 1);\n>   \tif (expanded) {\n> @@ -239,7 +237,8 @@ static int include_by_gitdir(const struct key_value_info *kvi,\n>   {\n>   \tstruct strbuf text = STRBUF_INIT;\n>   \tstruct strbuf pattern = STRBUF_INIT;\n> -\tint ret = 0, prefix;\n> +\tsize_t prefix;\n> +\tint ret = 0;\n>   \tconst char *git_dir;\n>   \tint already_tried_absolute = 0;\n>   \n> @@ -253,9 +252,6 @@ static int include_by_gitdir(const struct key_value_info *kvi,\n>   \tprefix = prepare_include_condition_pattern(kvi, &pattern);\n>   \n>   again:\n> -\tif (prefix < 0)\n> -\t\tgoto done;\n> -\n>   \tif (prefix > 0) {\n>   \t\t/*\n>   \t\t * perform literal matching on the prefix part so that\n> @@ -724,7 +720,6 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n>   \tif (env) {\n>   \t\tunsigned long count;\n>   \t\tchar *endp;\n> -\t\tint i;\n>   \n>   \t\tcount = strtoul(env, &endp, 10);\n>   \t\tif (*endp) {\n> @@ -736,10 +731,10 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n>   \t\t\tgoto out;\n>   \t\t}\n>   \n> -\t\tfor (i = 0; i < count; i++) {\n> +\t\tfor (unsigned long i = 0; i < count; i++) {\n>   \t\t\tconst char *key, *value;\n>   \n> -\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_KEY_%d\", i);\n> +\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_KEY_%lu\", i);\n>   \t\t\tkey = getenv_safe(&to_free, envvar.buf);\n>   \t\t\tif (!key) {\n>   \t\t\t\tret = error(_(\"missing config key %s\"), envvar.buf);\n> @@ -747,7 +742,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n>   \t\t\t}\n>   \t\t\tstrbuf_reset(&envvar);\n>   \n> -\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_VALUE_%d\", i);\n> +\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_VALUE_%lu\", i);\n>   \t\t\tvalue = getenv_safe(&to_free, envvar.buf);\n>   \t\t\tif (!value) {\n>   \t\t\t\tret = error(_(\"missing config value %s\"), envvar.buf);\n> @@ -1614,13 +1609,13 @@ int config_with_options(config_fn_t fn, void *data,\n>   \n>   static void configset_iter(struct config_set *set, config_fn_t fn, void *data)\n>   {\n> -\tint i, value_index;\n> +\tint value_index;\n>   \tstruct string_list *values;\n>   \tstruct config_set_element *entry;\n>   \tstruct configset_list *list = &set->list;\n>   \tstruct config_context ctx = CONFIG_CONTEXT_INIT;\n>   \n> -\tfor (i = 0; i < list->nr; i++) {\n> +\tfor (size_t i = 0; i < list->nr; i++) {\n>   \t\tentry = list->items[i].e;\n>   \t\tvalue_index = list->items[i].value_index;\n>   \t\tvalues = &entry->value_list;\n> @@ -2470,10 +2465,11 @@ static ssize_t write_pair(int fd, const char *key, const char *value,\n>    */\n>   static void maybe_remove_section(struct config_store_data *store,\n>   \t\t\t\t size_t *begin_offset, size_t *end_offset,\n> -\t\t\t\t int *seen_ptr)\n> +\t\t\t\t unsigned *seen_ptr)\n>   {\n>   \tsize_t begin;\n> -\tint i, seen, section_seen = 0;\n> +\tint section_seen = 0;\n> +\tunsigned int i, seen;\n>   \n>   \t/*\n>   \t * First, ensure that this is the first key, and that there are no\n> @@ -2716,7 +2712,8 @@ int repo_config_set_multivar_in_file_gently(struct repository *r,\n>   \t} else {\n>   \t\tstruct stat st;\n>   \t\tsize_t copy_begin, copy_end;\n> -\t\tint i, new_line = 0;\n> +\t\tunsigned i;\n> +\t\tint new_line = 0;\n>   \t\tstruct config_options opts;\n>   \n>   \t\tif (!value_pattern)\n> \n\n"},{"id":"522546","messageId":"aIDl0tiAmBrQU8Ql@pks.im","threadId":"63803","inReplyTo":"2b914b60-3417-4a49-b545-3109c9a05257@gmail.com","subject":"Re: [PATCH 21/21] config: fix sign comparison warnings","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T13:38:36Z","receivedAt":"2025-07-23T13:38:48Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Jul 23, 2025 at 10:38:16AM +0100, Phillip Wood wrote:\n> Hi Patrick\n> \n> On 17/07/2025 11:49, Patrick Steinhardt wrote:\n> > There are a couple of -Wsign-compare warnings in \"config.c\":\n> > \n> >    - `prepare_include_condition_pattern()` is declared to return a signed\n> >      int, but it either returns 0 or the index of the last dir separator\n> >      in a path.\n> \n> That is not correct, the function contains the lines\n> \n>               if (!kvi || !kvi->path)\n>                         return error(_(\"relative config include \"\n>                                        \"conditionals must come from\n> files\"));\n> \n> so a negative return value is possible.\n\nOh dear, I totally missed this one. Good catch, will fix in the next\nversion of this series. Thanks!\n\nPatrick\n"},{"id":"522547","messageId":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im","subject":"[PATCH v2 00/21] config: remove use of `the_repository`","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:21Z","receivedAt":"2025-07-23T14:08:32Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Hi,\n\nthis patch series removes uses of `the_repository` in \"config.c\". It\ndoes this via two things:\n\n  - By removing all the wrapper functions `git_config_get()` et al that\n    implicitly rely on `the_repository`.\n\n  - By moving the Git-specific config parsing (that is, the non-business\n    logic like parsing \"core.sharedRepository\") into \"environment.c\".\n\nThis series is inspired by my painful tries yesterday to start parsing\nrepo settings early in the Git process lifecycle. The changes should\nmake it easier to eventually achieve that.\n\nThe patch series is long, but almost all of the patches are trivial as\nthey simply replace code like `git_config_foo(...)` with its equivalent\n`repo_config_foo(the_repository, ...)`.\n\nThe series is based on top of 90c0775e972 (The eleventh batch,\n2025-07-16) with bc/use-sha256-by-default-in-3.0 at c79bb70a2e7 (Enable\nSHA-256 by default in breaking changes mode, 2025-07-01) merged into it\nto fix a conflict with \"next\". There are a couple of merge conflicts\nwith \"seen\", but they are trivial to solve.\n\nChanges in v2:\n  - Fix `prepare_include_condition_pattern()`.\n  - Link to v1: https://lore.kernel.org/r/20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im\n\nThanks!\n\nPatrick\n\n---\nPatrick Steinhardt (21):\n      config: drop `git_config()` wrapper\n      config: drop `git_config_clear()` wrapper\n      config: drop `git_config_get()` wrapper\n      config: drop `git_config_get_value()` wrapper\n      config: drop `git_config_get_value()` wrapper\n      config: drop `git_config_get_string_multi()` wrapper\n      config: drop `git_config_get_string()` wrapper\n      config: drop `git_config_get_string()` wrapper\n      config: drop `git_config_get_int()` wrapper\n      config: drop `git_config_get_ulong()` wrapper\n      config: drop `git_config_get_bool()` wrapper\n      config: drop `git_config_set_in_file()` wrapper\n      config: drop `git_config_set_gently()` wrapper\n      config: drop `git_config_set()` wrapper\n      config: drop `git_config_set_in_file_gently()` wrapper\n      config: drop `git_config_set_multivar_in_file_gently()` wrapper\n      config: drop `git_config_get_multivar_gently()` wrapper\n      config: drop `git_config_set_multivar()` wrapper\n      config: remove unused `the_repository` wrappers\n      config: move Git config parsing into \"environment.c\"\n      config: fix sign comparison warnings\n\n Documentation/user-manual.adoc                 |   2 +-\n apply.c                                        |   6 +-\n archive-tar.c                                  |   2 +-\n archive-zip.c                                  |   2 +-\n archive.c                                      |   4 +-\n branch.c                                       |  10 +-\n builtin/add.c                                  |   1 +\n builtin/am.c                                   |  10 +-\n builtin/blame.c                                |   2 +-\n builtin/branch.c                               |   8 +-\n builtin/cat-file.c                             |   2 +-\n builtin/check-attr.c                           |   2 +-\n builtin/check-ignore.c                         |   3 +-\n builtin/check-mailmap.c                        |   3 +-\n builtin/checkout--worker.c                     |   3 +-\n builtin/checkout-index.c                       |   1 +\n builtin/checkout.c                             |   4 +-\n builtin/clean.c                                |   3 +-\n builtin/clone.c                                |  26 +-\n builtin/column.c                               |   4 +-\n builtin/commit-graph.c                         |   5 +-\n builtin/commit-tree.c                          |   3 +-\n builtin/commit.c                               |   4 +-\n builtin/config.c                               |  60 +--\n builtin/count-objects.c                        |   3 +-\n builtin/credential-cache--daemon.c             |   2 +-\n builtin/credential-store.c                     |   2 +-\n builtin/credential.c                           |   3 +-\n builtin/describe.c                             |   2 +-\n builtin/diff-files.c                           |   2 +-\n builtin/diff-index.c                           |   2 +-\n builtin/diff-tree.c                            |   2 +-\n builtin/diff.c                                 |   2 +-\n builtin/fast-export.c                          |   3 +-\n builtin/fast-import.c                          |  12 +-\n builtin/fetch.c                                |  10 +-\n builtin/fmt-merge-msg.c                        |   2 +-\n builtin/for-each-ref.c                         |   1 +\n builtin/fsck.c                                 |   2 +-\n builtin/fsmonitor--daemon.c                    |   3 +-\n builtin/gc.c                                   |  70 ++--\n builtin/grep.c                                 |   5 +-\n builtin/hash-object.c                          |   3 +-\n builtin/help.c                                 |   5 +-\n builtin/hook.c                                 |   3 +-\n builtin/index-pack.c                           |   2 +-\n builtin/interpret-trailers.c                   |   3 +-\n builtin/log.c                                  |  24 +-\n builtin/ls-files.c                             |   1 +\n builtin/ls-tree.c                              |   3 +-\n builtin/merge-base.c                           |   3 +-\n builtin/merge-file.c                           |   2 +-\n builtin/merge-tree.c                           |   3 +-\n builtin/merge.c                                |   2 +-\n builtin/mktag.c                                |   2 +-\n builtin/multi-pack-index.c                     |   5 +-\n builtin/mv.c                                   |   2 +-\n builtin/name-rev.c                             |   2 +-\n builtin/notes.c                                |   4 +-\n builtin/pack-objects.c                         |   2 +-\n builtin/pack-refs.c                            |   1 +\n builtin/patch-id.c                             |   3 +-\n builtin/pull.c                                 |   9 +-\n builtin/push.c                                 |   2 +-\n builtin/range-diff.c                           |   2 +-\n builtin/read-tree.c                            |   3 +-\n builtin/rebase.c                               |   4 +-\n builtin/receive-pack.c                         |   2 +-\n builtin/reflog.c                               |   2 +-\n builtin/refs.c                                 |   2 +-\n builtin/remote.c                               |  56 +--\n builtin/repack.c                               |   2 +-\n builtin/replace.c                              |   3 +-\n builtin/rerere.c                               |   2 +-\n builtin/reset.c                                |   2 +-\n builtin/rev-list.c                             |   2 +-\n builtin/rev-parse.c                            |   4 +-\n builtin/rm.c                                   |   3 +-\n builtin/send-pack.c                            |   1 +\n builtin/shortlog.c                             |   2 +-\n builtin/show-branch.c                          |   2 +-\n builtin/show-ref.c                             |   3 +-\n builtin/sparse-checkout.c                      |   2 +-\n builtin/stash.c                                |   4 +-\n builtin/stripspace.c                           |   2 +-\n builtin/submodule--helper.c                    |  56 +--\n builtin/symbolic-ref.c                         |   3 +-\n builtin/tag.c                                  |   2 +-\n builtin/unpack-file.c                          |   3 +-\n builtin/unpack-objects.c                       |   2 +-\n builtin/update-index.c                         |   2 +-\n builtin/update-ref.c                           |   3 +-\n builtin/update-server-info.c                   |   1 +\n builtin/var.c                                  |   5 +-\n builtin/verify-commit.c                        |   1 +\n builtin/verify-pack.c                          |   3 +-\n builtin/verify-tag.c                           |   1 +\n builtin/worktree.c                             |   8 +-\n builtin/write-tree.c                           |   3 +-\n checkout.c                                     |   2 +-\n commit-graph.c                                 |   1 +\n compat/precompose_utf8.c                       |   6 +-\n config.c                                       | 553 +------------------------\n config.h                                       | 139 -------\n connect.c                                      |   6 +-\n contrib/coccinelle/config_fn_ctx.pending.cocci |   2 +-\n convert.c                                      |   2 +-\n daemon.c                                       |   2 +-\n dir.c                                          |   4 +-\n editor.c                                       |   2 +-\n environment.c                                  | 512 +++++++++++++++++++++++\n environment.h                                  |   3 +\n fetch-pack.c                                   |  16 +-\n fsck.c                                         |   1 +\n fsck.h                                         |   2 +-\n fsmonitor.c                                    |   2 +-\n gpg-interface.c                                |   2 +-\n help.c                                         |   6 +-\n http-backend.c                                 |   6 +-\n http-fetch.c                                   |   3 +-\n http.c                                         |   3 +-\n imap-send.c                                    |   3 +-\n list-objects-filter-options.c                  |   6 +-\n ls-refs.c                                      |   2 +-\n mailinfo.c                                     |   1 +\n merge-ll.c                                     |   2 +-\n merge-ort.c                                    |  18 +-\n notes-utils.c                                  |   2 +-\n notes.c                                        |   2 +-\n parallel-checkout.c                            |   4 +-\n pretty.c                                       |   2 +-\n promisor-remote.c                              |   8 +-\n protocol.c                                     |   2 +-\n reachable.c                                    |   2 +-\n read-cache.c                                   |   4 +-\n rebase-interactive.c                           |   2 +-\n reflog.c                                       |   1 +\n refs.c                                         |   2 +-\n refs/packed-backend.c                          |   2 +-\n refs/reftable-backend.c                        |   2 +-\n remote.c                                       |   2 +-\n rerere.c                                       |   9 +-\n revision.c                                     |   2 +-\n run-command.c                                  |   6 +-\n scalar.c                                       |  18 +-\n sequencer.c                                    |  36 +-\n setup.c                                        |  44 +-\n sideband.c                                     |   6 +-\n submodule-config.c                             |   2 +-\n submodule.c                                    |   2 +-\n t/helper/test-advise.c                         |   3 +-\n t/helper/test-config.c                         |  20 +-\n t/helper/test-read-cache.c                     |   3 +-\n t/helper/test-userdiff.c                       |   2 +-\n t/t4256/1/mailinfo.c                           |   2 +-\n t/t4256/1/mailinfo.c.orig                      |   2 +-\n trailer.c                                      |   4 +-\n transport.c                                    |  12 +-\n versioncmp.c                                   |   4 +-\n worktree.c                                     |   8 +-\n xdiff-interface.c                              |   1 +\n 161 files changed, 1015 insertions(+), 1097 deletions(-)\n\nRange-diff versus v1:\n\n 1:  1caf1bc3c2b =  1:  44ad8fd172e config: drop `git_config()` wrapper\n 2:  e9c1afb5307 =  2:  392db3dad1a config: drop `git_config_clear()` wrapper\n 3:  8beb9c49e86 =  3:  31ee448c82f config: drop `git_config_get()` wrapper\n 4:  defb931ab24 =  4:  0540beca321 config: drop `git_config_get_value()` wrapper\n 5:  e0f662adf59 =  5:  0fd69dac496 config: drop `git_config_get_value()` wrapper\n 6:  16e10b9fcff =  6:  9d2aff44bf5 config: drop `git_config_get_string_multi()` wrapper\n 7:  a4022b64c8f =  7:  34e8b394683 config: drop `git_config_get_string()` wrapper\n 8:  0d8ebc40ce3 =  8:  9a374f91689 config: drop `git_config_get_string()` wrapper\n 9:  5c06c8e2cc5 =  9:  5dd2f4682f7 config: drop `git_config_get_int()` wrapper\n10:  522ff9be738 = 10:  30a338834a9 config: drop `git_config_get_ulong()` wrapper\n11:  6b1a8c902d2 = 11:  3a723697ac3 config: drop `git_config_get_bool()` wrapper\n12:  ee9e8479b40 = 12:  176d71ab70e config: drop `git_config_set_in_file()` wrapper\n13:  d69766a5087 = 13:  f00c8048a9a config: drop `git_config_set_gently()` wrapper\n14:  25f6c2dde6d = 14:  5db30c36fca config: drop `git_config_set()` wrapper\n15:  3554ad9d8bc = 15:  33a3b8ae60f config: drop `git_config_set_in_file_gently()` wrapper\n16:  deb51a25357 = 16:  d24ab4b79e5 config: drop `git_config_set_multivar_in_file_gently()` wrapper\n17:  a919f54c0ec = 17:  b947eb22a27 config: drop `git_config_get_multivar_gently()` wrapper\n18:  c8f314bdca3 = 18:  e69c6d8de77 config: drop `git_config_set_multivar()` wrapper\n19:  3f96884550b = 19:  ff3af8ad687 config: remove unused `the_repository` wrappers\n20:  a21206a973d = 20:  d9da8cdfd18 config: move Git config parsing into \"environment.c\"\n21:  4630929ebca ! 21:  fff5f00184c config: fix sign comparison warnings\n    @@ Commit message\n     \n         There are a couple of -Wsign-compare warnings in \"config.c\":\n     \n    -      - `prepare_include_condition_pattern()` is declared to return a signed\n    -        int, but it either returns 0 or the index of the last dir separator\n    -        in a path. That index will always be positive, so the return type of\n    -        the function is changed to `size_t`, which allows us to drop a check\n    -        for `prefix < 0` at the only callsite. Furthermore, this fixes a\n    -        sign comparison warning when comparing `text.len < prefix`,\n    +      - `prepare_include_condition_pattern()` is returns a signed integer,\n    +        where it either returns a negative error code or the index of the\n    +        last dir separator in a path. That index will always be a\n    +        non-negative number, but we cannot just change the return type to a\n    +        `size_t` due to it being re-used as error code. This is fixed by\n    +        splitting up concerns: the return value is only used as error code,\n    +        and the prefix is now returned via an out-pointer. This fixes a sign\n    +        comparison warning when comparing `text.len < prefix`,\n     \n           - We treat `struct config_store_data::seen` as signed integer in\n             several places even though it's unsigned.\n    @@ config.c\n      #include \"abspath.h\"\n      #include \"date.h\"\n     @@ config.c: static void add_trailing_starstar_for_dir(struct strbuf *pat)\n    - \t\tstrbuf_addstr(pat, \"**\");\n      }\n      \n    --static int prepare_include_condition_pattern(const struct key_value_info *kvi,\n    + static int prepare_include_condition_pattern(const struct key_value_info *kvi,\n     -\t\t\t\t\t     struct strbuf *pat)\n    -+static size_t prepare_include_condition_pattern(const struct key_value_info *kvi,\n    -+\t\t\t\t\t\tstruct strbuf *pat)\n    ++\t\t\t\t\t     struct strbuf *pat,\n    ++\t\t\t\t\t     size_t *out)\n      {\n      \tstruct strbuf path = STRBUF_INIT;\n      \tchar *expanded;\n    @@ config.c: static void add_trailing_starstar_for_dir(struct strbuf *pat)\n      \n      \texpanded = interpolate_path(pat->buf, 1);\n      \tif (expanded) {\n    +@@ config.c: static int prepare_include_condition_pattern(const struct key_value_info *kvi,\n    + \n    + \tadd_trailing_starstar_for_dir(pat);\n    + \n    ++\t*out = prefix;\n    ++\n    + \tstrbuf_release(&path);\n    +-\treturn prefix;\n    ++\treturn 0;\n    + }\n    + \n    + static int include_by_gitdir(const struct key_value_info *kvi,\n     @@ config.c: static int include_by_gitdir(const struct key_value_info *kvi,\n      {\n      \tstruct strbuf text = STRBUF_INIT;\n    @@ config.c: static int include_by_gitdir(const struct key_value_info *kvi,\n      \tint already_tried_absolute = 0;\n      \n     @@ config.c: static int include_by_gitdir(const struct key_value_info *kvi,\n    - \tprefix = prepare_include_condition_pattern(kvi, &pattern);\n      \n    - again:\n    --\tif (prefix < 0)\n    --\t\tgoto done;\n    + \tstrbuf_realpath(&text, git_dir, 1);\n    + \tstrbuf_add(&pattern, cond, cond_len);\n    +-\tprefix = prepare_include_condition_pattern(kvi, &pattern);\n     -\n    +-again:\n    +-\tif (prefix < 0)\n    ++\tret = prepare_include_condition_pattern(kvi, &pattern, &prefix);\n    ++\tif (ret < 0)\n    + \t\tgoto done;\n    + \n    ++again:\n      \tif (prefix > 0) {\n      \t\t/*\n      \t\t * perform literal matching on the prefix part so that\n\n---\nbase-commit: 592f97530d99d182d69c66e08279e189d006b410\nchange-id: 20250716-pks-config-wo-the-repository-21de9489f965\n\n"},{"id":"522548","messageId":"20250723-pks-config-wo-the-repository-v2-1-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 01/21] config: drop `git_config()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:22Z","receivedAt":"2025-07-23T14:08:34Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config()`. All callsites\nare adjusted so that they use `repo_config(the_repository, ...)`\ninstead. While some callsites might already have a repository available,\nthis mechanical conversion is the exact same as the current situation\nand thus cannot cause any regression. Those sites should eventually be\ncleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n Documentation/user-manual.adoc                 |  2 +-\n apply.c                                        |  2 +-\n archive-tar.c                                  |  2 +-\n archive-zip.c                                  |  2 +-\n archive.c                                      |  2 +-\n builtin/am.c                                   |  2 +-\n builtin/blame.c                                |  2 +-\n builtin/branch.c                               |  2 +-\n builtin/cat-file.c                             |  2 +-\n builtin/check-attr.c                           |  2 +-\n builtin/check-ignore.c                         |  2 +-\n builtin/check-mailmap.c                        |  2 +-\n builtin/checkout--worker.c                     |  2 +-\n builtin/checkout.c                             |  2 +-\n builtin/clean.c                                |  2 +-\n builtin/clone.c                                |  4 ++--\n builtin/column.c                               |  4 ++--\n builtin/commit-graph.c                         |  4 ++--\n builtin/commit-tree.c                          |  2 +-\n builtin/commit.c                               |  4 ++--\n builtin/config.c                               |  2 +-\n builtin/count-objects.c                        |  2 +-\n builtin/credential.c                           |  2 +-\n builtin/describe.c                             |  2 +-\n builtin/diff-files.c                           |  2 +-\n builtin/diff-index.c                           |  2 +-\n builtin/diff-tree.c                            |  2 +-\n builtin/diff.c                                 |  2 +-\n builtin/fast-export.c                          |  2 +-\n builtin/fast-import.c                          |  2 +-\n builtin/fetch.c                                |  4 ++--\n builtin/fmt-merge-msg.c                        |  2 +-\n builtin/fsck.c                                 |  2 +-\n builtin/fsmonitor--daemon.c                    |  2 +-\n builtin/gc.c                                   |  2 +-\n builtin/grep.c                                 |  2 +-\n builtin/hash-object.c                          |  2 +-\n builtin/help.c                                 |  4 ++--\n builtin/hook.c                                 |  2 +-\n builtin/index-pack.c                           |  2 +-\n builtin/interpret-trailers.c                   |  2 +-\n builtin/log.c                                  | 20 ++++++++++----------\n builtin/ls-tree.c                              |  2 +-\n builtin/merge-base.c                           |  2 +-\n builtin/merge-file.c                           |  2 +-\n builtin/merge-tree.c                           |  2 +-\n builtin/merge.c                                |  2 +-\n builtin/mktag.c                                |  2 +-\n builtin/multi-pack-index.c                     |  4 ++--\n builtin/mv.c                                   |  2 +-\n builtin/name-rev.c                             |  2 +-\n builtin/notes.c                                |  2 +-\n builtin/pack-objects.c                         |  2 +-\n builtin/patch-id.c                             |  2 +-\n builtin/pull.c                                 |  2 +-\n builtin/push.c                                 |  2 +-\n builtin/range-diff.c                           |  2 +-\n builtin/read-tree.c                            |  2 +-\n builtin/rebase.c                               |  2 +-\n builtin/receive-pack.c                         |  2 +-\n builtin/reflog.c                               |  2 +-\n builtin/refs.c                                 |  2 +-\n builtin/remote.c                               |  6 +++---\n builtin/repack.c                               |  2 +-\n builtin/replace.c                              |  2 +-\n builtin/rerere.c                               |  2 +-\n builtin/reset.c                                |  2 +-\n builtin/rev-list.c                             |  2 +-\n builtin/rev-parse.c                            |  4 ++--\n builtin/rm.c                                   |  2 +-\n builtin/shortlog.c                             |  2 +-\n builtin/show-branch.c                          |  2 +-\n builtin/show-ref.c                             |  2 +-\n builtin/sparse-checkout.c                      |  2 +-\n builtin/stash.c                                |  4 ++--\n builtin/stripspace.c                           |  2 +-\n builtin/submodule--helper.c                    |  8 ++++----\n builtin/symbolic-ref.c                         |  2 +-\n builtin/tag.c                                  |  2 +-\n builtin/unpack-file.c                          |  2 +-\n builtin/unpack-objects.c                       |  2 +-\n builtin/update-index.c                         |  2 +-\n builtin/update-ref.c                           |  2 +-\n builtin/var.c                                  |  4 ++--\n builtin/verify-pack.c                          |  2 +-\n builtin/worktree.c                             |  2 +-\n builtin/write-tree.c                           |  2 +-\n config.h                                       |  5 -----\n connect.c                                      |  2 +-\n contrib/coccinelle/config_fn_ctx.pending.cocci |  2 +-\n convert.c                                      |  2 +-\n fetch-pack.c                                   |  2 +-\n fsck.h                                         |  2 +-\n gpg-interface.c                                |  2 +-\n help.c                                         |  4 ++--\n http-fetch.c                                   |  2 +-\n http.c                                         |  2 +-\n imap-send.c                                    |  2 +-\n ls-refs.c                                      |  2 +-\n merge-ll.c                                     |  2 +-\n merge-ort.c                                    |  2 +-\n notes-utils.c                                  |  2 +-\n notes.c                                        |  2 +-\n pretty.c                                       |  2 +-\n refs/reftable-backend.c                        |  2 +-\n rerere.c                                       |  4 ++--\n revision.c                                     |  2 +-\n scalar.c                                       |  2 +-\n sequencer.c                                    |  2 +-\n setup.c                                        |  4 ++--\n t/helper/test-advise.c                         |  2 +-\n t/helper/test-config.c                         |  8 ++++----\n t/helper/test-read-cache.c                     |  2 +-\n t/helper/test-userdiff.c                       |  2 +-\n t/t4256/1/mailinfo.c                           |  2 +-\n t/t4256/1/mailinfo.c.orig                      |  2 +-\n trailer.c                                      |  4 ++--\n transport.c                                    |  2 +-\n 118 files changed, 148 insertions(+), 153 deletions(-)\n\ndiff --git a/Documentation/user-manual.adoc b/Documentation/user-manual.adoc\nindex 8d00a9e8229..76969871176 100644\n--- a/Documentation/user-manual.adoc\n+++ b/Documentation/user-manual.adoc\n@@ -4270,7 +4270,7 @@ So, look into `builtin/cat-file.c`, search for `cmd_cat_file()` and look what\n it does.\n \n ------------------------------------------------------------------\n-        git_config(git_default_config);\n+        repo_config(the_repository, git_default_config);\n         if (argc != 3)\n \t\tusage(\"git cat-file [-t|-s|-e|-p|<type>] <sha1>\");\n         if (get_sha1(argv[2], sha1))\ndiff --git a/apply.c b/apply.c\nindex a3804316fbd..d2381a157c0 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -50,7 +50,7 @@ static void git_apply_config(void)\n {\n \tgit_config_get_string(\"apply.whitespace\", &apply_default_whitespace);\n \tgit_config_get_string(\"apply.ignorewhitespace\", &apply_default_ignorewhitespace);\n-\tgit_config(git_xmerge_config, NULL);\n+\trepo_config(the_repository, git_xmerge_config, NULL);\n }\n \n static int parse_whitespace_option(struct apply_state *state, const char *option)\ndiff --git a/archive-tar.c b/archive-tar.c\nindex 249164ea77d..73b63ddc41b 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -537,7 +537,7 @@ void init_tar_archiver(void)\n \ttar_filter_config(\"tar.tgz.remote\", \"true\", NULL);\n \ttar_filter_config(\"tar.tar.gz.command\", internal_gzip_command, NULL);\n \ttar_filter_config(\"tar.tar.gz.remote\", \"true\", NULL);\n-\tgit_config(git_tar_config, NULL);\n+\trepo_config(the_repository, git_tar_config, NULL);\n \tfor (i = 0; i < nr_tar_filters; i++) {\n \t\t/* omit any filters that never had a command configured */\n \t\tif (tar_filters[i]->filter_command)\ndiff --git a/archive-zip.c b/archive-zip.c\nindex df8866d5bae..dbd90d9c3d4 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -632,7 +632,7 @@ static int write_zip_archive(const struct archiver *ar UNUSED,\n {\n \tint err;\n \n-\tgit_config(archive_zip_config, NULL);\n+\trepo_config(the_repository, archive_zip_config, NULL);\n \n \tdos_time(&args->time, &zip_date, &zip_time);\n \ndiff --git a/archive.c b/archive.c\nindex f5a9d45c8d3..2dd306a07a7 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -761,7 +761,7 @@ int write_archive(int argc, const char **argv, const char *prefix,\n \tint rc;\n \n \tgit_config_get_bool(\"uploadarchive.allowunreachable\", &remote_allow_unreachable);\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tdescribe_status.max_invocations = 1;\n \tctx.date_mode.type = DATE_NORMAL;\ndiff --git a/builtin/am.c b/builtin/am.c\nindex c9d925f7b96..a7e7cf1465a 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -2445,7 +2445,7 @@ int cmd_am(int argc,\n \n \tshow_usage_with_options_if_asked(argc, argv, usage, options);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tam_state_init(&state);\n \ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 91586e6852b..71efeb7c7e6 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -947,7 +947,7 @@ int cmd_blame(int argc,\n \tconst char *const *opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage;\n \n \tsetup_default_color_by_age();\n-\tgit_config(git_blame_config, &output_option);\n+\trepo_config(the_repository, git_blame_config, &output_option);\n \trepo_init_revisions(the_repository, &revs, NULL);\n \trevs.date_mode = blame_date_mode;\n \trevs.diffopt.flags.allow_textconv = 1;\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex c150131bd9f..08e50bf77b3 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -791,7 +791,7 @@ int cmd_branch(int argc,\n \t * Try to set sort keys from config. If config does not set any,\n \t * fall back on default (refname) sorting.\n \t */\n-\tgit_config(git_branch_config, &sorting_options);\n+\trepo_config(the_repository, git_branch_config, &sorting_options);\n \tif (!sorting_options.nr)\n \t\tstring_list_append(&sorting_options, \"refname\");\n \ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 2492a0b6f39..b9eb2bb3b92 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -1095,7 +1095,7 @@ int cmd_cat_file(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_cat_file_config, NULL);\n+\trepo_config(the_repository, git_cat_file_config, NULL);\n \n \tbatch.buffer_output = -1;\n \ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex 7cf275b8937..51ed48ce437 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -119,7 +119,7 @@ int cmd_check_attr(int argc,\n \tif (!is_bare_repository())\n \t\tsetup_work_tree();\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, check_attr_options,\n \t\t\t     check_attr_usage, PARSE_OPT_KEEP_DASHDASH);\ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex 7b7831d13a8..03033499cb0 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -159,7 +159,7 @@ int cmd_check_ignore(int argc,\n \tint num_ignored;\n \tstruct dir_struct dir = DIR_INIT;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, check_ignore_options,\n \t\t\t     check_ignore_usage, 0);\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex be2cebe1215..634626c6728 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -56,7 +56,7 @@ int cmd_check_mailmap(int argc,\n \tint i;\n \tstruct string_list mailmap = STRING_LIST_INIT_NODUP;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, check_mailmap_options,\n \t\t\t     check_mailmap_usage, 0);\n \tif (argc == 0 && !use_stdin)\ndiff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c\nindex da9345a44b8..27a7d4f0409 100644\n--- a/builtin/checkout--worker.c\n+++ b/builtin/checkout--worker.c\n@@ -132,7 +132,7 @@ int cmd_checkout__worker(int argc,\n \t\t\t\t\t checkout_worker_usage,\n \t\t\t\t\t checkout_worker_options);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, checkout_worker_options,\n \t\t\t     checkout_worker_usage, 0);\n \tif (argc > 0)\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 0a90b86a729..948ff7bdda7 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -1764,7 +1764,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,\n \topts->prefix = prefix;\n \topts->show_progress = -1;\n \n-\tgit_config(git_checkout_config, opts);\n+\trepo_config(the_repository, git_checkout_config, opts);\n \tif (the_repository->gitdir) {\n \t\tprepare_repo_settings(the_repository);\n \t\tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 053c94fc6bd..5ee147c4acc 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -949,7 +949,7 @@ int cmd_clean(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_clean_config, NULL);\n+\trepo_config(the_repository, git_clean_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, options, builtin_clean_usage,\n \t\t\t     0);\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 6d08abed37c..3c6d8529b6c 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -1001,7 +1001,7 @@ int cmd_clone(int argc,\n \n \tpacket_trace_identity(\"clone\");\n \n-\tgit_config(git_clone_config, NULL);\n+\trepo_config(the_repository, git_clone_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, builtin_clone_options,\n \t\t\t     builtin_clone_usage, 0);\n@@ -1242,7 +1242,7 @@ int cmd_clone(int argc,\n \t * re-read config after init_db and write_config to pick up any config\n \t * injected by --template and --config, respectively.\n \t */\n-\tgit_config(git_clone_config, NULL);\n+\trepo_config(the_repository, git_clone_config, NULL);\n \n \t/*\n \t * If option_reject_shallow is specified from CLI option,\ndiff --git a/builtin/column.c b/builtin/column.c\nindex ce6443d5fac..87dce3c6e53 100644\n--- a/builtin/column.c\n+++ b/builtin/column.c\n@@ -42,9 +42,9 @@ int cmd_column(int argc,\n \t/* This one is special and must be the first one */\n \tif (argc > 1 && starts_with(argv[1], \"--command=\")) {\n \t\tcommand = argv[1] + 10;\n-\t\tgit_config(column_config, (void *)command);\n+\t\trepo_config(the_repository, column_config, (void *)command);\n \t} else\n-\t\tgit_config(column_config, NULL);\n+\t\trepo_config(the_repository, column_config, NULL);\n \n \tmemset(&copts, 0, sizeof(copts));\n \tcopts.padding = 1;\ndiff --git a/builtin/commit-graph.c b/builtin/commit-graph.c\nindex 25018a0b9df..c5cc601844c 100644\n--- a/builtin/commit-graph.c\n+++ b/builtin/commit-graph.c\n@@ -265,7 +265,7 @@ static int graph_write(int argc, const char **argv, const char *prefix,\n \n \ttrace2_cmd_mode(\"write\");\n \n-\tgit_config(git_commit_graph_write_config, &opts);\n+\trepo_config(the_repository, git_commit_graph_write_config, &opts);\n \n \targc = parse_options(argc, argv, prefix,\n \t\t\t     options,\n@@ -347,7 +347,7 @@ int cmd_commit_graph(int argc,\n \t};\n \tstruct option *options = parse_options_concat(builtin_commit_graph_options, common_opts);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tdisable_replace_refs();\n \tsave_commit_buffer = 0;\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex 31cfd9bd15d..2f1df28d413 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -125,7 +125,7 @@ int cmd_commit_tree(int argc,\n \t};\n \tint ret;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tshow_usage_with_options_if_asked(argc, argv,\n \t\t\t\t\t commit_tree_usage, options);\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex fba0dded64a..fcd829e04ec 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -207,9 +207,9 @@ static void status_init_config(struct wt_status *s, config_fn_t fn)\n {\n \twt_status_prepare(the_repository, s);\n \tinit_diff_ui_defaults();\n-\tgit_config(fn, s);\n+\trepo_config(the_repository, fn, s);\n \tdetermine_whence(s);\n-\ts->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after git_config() */\n+\ts->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after repo_config() */\n }\n \n static void rollback_index_files(void)\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 5efe2730106..af5d79eadc0 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -1091,7 +1091,7 @@ static int show_editor(struct config_location_options *opts)\n \t\tdie(_(\"editing stdin is not supported\"));\n \tif (opts->source.blob)\n \t\tdie(_(\"editing blobs is not supported\"));\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \tconfig_file = opts->source.file ?\n \t\t\txstrdup(opts->source.file) :\n \t\t\trepo_git_path(the_repository, \"config\");\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex f687647931e..433daff805a 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -106,7 +106,7 @@ int cmd_count_objects(int argc,\n \t\tOPT_END(),\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, opts, count_objects_usage, 0);\n \t/* we do not take arguments other than flags for now */\ndiff --git a/builtin/credential.c b/builtin/credential.c\nindex 2e11b15dde3..52f172e80cb 100644\n--- a/builtin/credential.c\n+++ b/builtin/credential.c\n@@ -16,7 +16,7 @@ int cmd_credential(int argc,\n \tconst char *op;\n \tstruct credential c = CREDENTIAL_INIT;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tshow_usage_if_asked(argc, argv, usage_msg);\n \tif (argc != 2)\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex fbf305d7624..d7dd8139dec 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -623,7 +623,7 @@ int cmd_describe(int argc,\n \t\tOPT_END(),\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, options, describe_usage, 0);\n \tif (abbrev < 0)\n \t\tabbrev = DEFAULT_ABBREV;\ndiff --git a/builtin/diff-files.c b/builtin/diff-files.c\nindex 99b1749723b..ea91347ce23 100644\n--- a/builtin/diff-files.c\n+++ b/builtin/diff-files.c\n@@ -31,7 +31,7 @@ int cmd_diff_files(int argc,\n \n \tshow_usage_if_asked(argc, argv, diff_files_usage);\n \n-\tgit_config(git_diff_basic_config, NULL); /* no \"diff\" UI options */\n+\trepo_config(the_repository, git_diff_basic_config, NULL); /* no \"diff\" UI options */\n \n \tprepare_repo_settings(the_repository);\n \tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex 81c0bc8ed7c..522dacfc4cf 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -28,7 +28,7 @@ int cmd_diff_index(int argc,\n \n \tshow_usage_if_asked(argc, argv, diff_cache_usage);\n \n-\tgit_config(git_diff_basic_config, NULL); /* no \"diff\" UI options */\n+\trepo_config(the_repository, git_diff_basic_config, NULL); /* no \"diff\" UI options */\n \n \tprepare_repo_settings(the_repository);\n \tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex e31cc797fe1..49dd4d00ebf 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -124,7 +124,7 @@ int cmd_diff_tree(int argc,\n \n \tshow_usage_if_asked(argc, argv, diff_tree_usage);\n \n-\tgit_config(git_diff_basic_config, NULL); /* no \"diff\" UI options */\n+\trepo_config(the_repository, git_diff_basic_config, NULL); /* no \"diff\" UI options */\n \n \tprepare_repo_settings(the_repository);\n \tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex eebffe36ccf..9a89e25a982 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -486,7 +486,7 @@ int cmd_diff(int argc,\n \t\trepo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);\n \n \tinit_diff_ui_defaults();\n-\tgit_config(git_diff_ui_config, NULL);\n+\trepo_config(the_repository, git_diff_ui_config, NULL);\n \tprefix = precompose_argv_prefix(argc, argv, prefix);\n \n \trepo_init_revisions(the_repository, &rev, prefix);\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 6a3a17a8cd9..17027b859e0 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -1327,7 +1327,7 @@ int cmd_fast_export(int argc,\n \t\tusage_with_options (fast_export_usage, options);\n \n \t/* we handle encodings */\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \trepo_init_revisions(the_repository, &revs, prefix);\n \tinit_revision_sources(&revision_sources);\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex b1389c59211..607441e921b 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -3541,7 +3541,7 @@ static void git_pack_config(void)\n \telse if (!git_config_get_int(\"transfer.unpacklimit\", &limit))\n \t\tunpack_limit = limit;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n }\n \n static const char fast_import_usage[] =\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 87a0cca7994..ea447c453d1 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -1995,7 +1995,7 @@ static int add_remote_or_group(const char *name, struct string_list *list)\n \tstruct remote_group_data g;\n \tg.name = name; g.list = list;\n \n-\tgit_config(get_remote_group, &g);\n+\trepo_config(the_repository, get_remote_group, &g);\n \tif (list->nr == prev_nr) {\n \t\tstruct remote *remote = remote_get(name);\n \t\tif (!remote_is_configured(remote, 0))\n@@ -2417,7 +2417,7 @@ int cmd_fetch(int argc,\n \t\tfree(anon);\n \t}\n \n-\tgit_config(git_fetch_config, &config);\n+\trepo_config(the_repository, git_fetch_config, &config);\n \tif (the_repository->gitdir) {\n \t\tprepare_repo_settings(the_repository);\n \t\tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 3b6aac2cf7f..edb93c0b3a3 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -53,7 +53,7 @@ int cmd_fmt_merge_msg(int argc,\n \tint ret;\n \tstruct fmt_merge_msg_opts opts;\n \n-\tgit_config(fmt_merge_msg_config, NULL);\n+\trepo_config(the_repository, fmt_merge_msg_config, NULL);\n \targc = parse_options(argc, argv, prefix, options, fmt_merge_msg_usage,\n \t\t\t     0);\n \tif (argc > 0)\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex 0084cf7400b..0ec6ca06e3b 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -987,7 +987,7 @@ int cmd_fsck(int argc,\n \tif (name_objects)\n \t\tfsck_enable_object_names(&fsck_walk_options);\n \n-\tgit_config(git_fsck_config, &fsck_obj_options);\n+\trepo_config(the_repository, git_fsck_config, &fsck_obj_options);\n \tprepare_repo_settings(the_repository);\n \n \tif (check_references)\ndiff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c\nindex 0820e524f1a..469c62b555b 100644\n--- a/builtin/fsmonitor--daemon.c\n+++ b/builtin/fsmonitor--daemon.c\n@@ -1547,7 +1547,7 @@ int cmd_fsmonitor__daemon(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(fsmonitor_config, NULL);\n+\trepo_config(the_repository, fsmonitor_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, options,\n \t\t\t     builtin_fsmonitor__daemon_usage, 0);\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex fab8f4dd4f7..d9e3b9d2ec3 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -228,7 +228,7 @@ static void gc_config(struct gc_config *cfg)\n \t\tcfg->repack_filter_to = owned;\n \t}\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n }\n \n enum schedule_priority {\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 39273d9c0fd..7982dda9a3b 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -1035,7 +1035,7 @@ int cmd_grep(int argc,\n \tgrep_prefix = prefix;\n \n \tgrep_init(&opt, the_repository);\n-\tgit_config(grep_cmd_config, &opt);\n+\trepo_config(the_repository, grep_cmd_config, &opt);\n \n \t/*\n \t * If there is no -- then the paths must exist in the working\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex ddf281413a6..c3ad1e91c96 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -111,7 +111,7 @@ int cmd_hash_object(int argc,\n \t\tvpath = vpath_free;\n \t}\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tif (stdin_paths) {\n \t\tif (hashstdin)\ndiff --git a/builtin/help.c b/builtin/help.c\nindex c257079cebc..d79ecd946a6 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -210,7 +210,7 @@ static enum help_format parse_help_format(const char *format)\n \tif (!strcmp(format, \"web\") || !strcmp(format, \"html\"))\n \t\treturn HELP_FORMAT_WEB;\n \t/*\n-\t * Please update _git_config() in git-completion.bash when you\n+\t * Please update _repo_config() in git-completion.bash when you\n \t * add new help formats.\n \t */\n \tdie(_(\"unrecognized help format '%s'\"), format);\n@@ -706,7 +706,7 @@ int cmd_help(int argc,\n \t}\n \n \tsetup_git_directory_gently(&nongit);\n-\tgit_config(git_help_config, NULL);\n+\trepo_config(the_repository, git_help_config, NULL);\n \n \tif (parsed_help_format != HELP_FORMAT_NONE)\n \t\thelp_format = parsed_help_format;\ndiff --git a/builtin/hook.c b/builtin/hook.c\nindex 672d2e37e84..044c27aa95d 100644\n--- a/builtin/hook.c\n+++ b/builtin/hook.c\n@@ -55,7 +55,7 @@ static int run(int argc, const char **argv, const char *prefix,\n \t\tstrvec_push(&opt.args, argv[i]);\n \n \t/* Need to take into account core.hooksPath */\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \thook_name = argv[0];\n \tif (!ignore_missing)\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 0a5c8a1ac85..53f1a7cd71e 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -1917,7 +1917,7 @@ int cmd_index_pack(int argc,\n \n \treset_pack_idx_option(&opts);\n \topts.flags |= WRITE_REV;\n-\tgit_config(git_index_pack_config, &opts);\n+\trepo_config(the_repository, git_index_pack_config, &opts);\n \tif (prefix && chdir(prefix))\n \t\tdie(_(\"Cannot come back to cwd\"));\n \ndiff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c\nindex 44d8ccddc9d..3141c37b853 100644\n--- a/builtin/interpret-trailers.c\n+++ b/builtin/interpret-trailers.c\n@@ -220,7 +220,7 @@ int cmd_interpret_trailers(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, options,\n \t\t\t     git_interpret_trailers_usage, 0);\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 24a57c20a41..1bedc4ef355 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -659,10 +659,10 @@ int cmd_whatchanged(int argc,\n \n \tlog_config_init(&cfg);\n \tinit_diff_ui_defaults();\n-\tgit_config(git_log_config, &cfg);\n+\trepo_config(the_repository, git_log_config, &cfg);\n \n \trepo_init_revisions(the_repository, &rev, prefix);\n-\tgit_config(grep_config, &rev.grep_filter);\n+\trepo_config(the_repository, grep_config, &rev.grep_filter);\n \n \trev.diff = 1;\n \trev.simplify_history = 0;\n@@ -790,7 +790,7 @@ int cmd_show(int argc,\n \n \tlog_config_init(&cfg);\n \tinit_diff_ui_defaults();\n-\tgit_config(git_log_config, &cfg);\n+\trepo_config(the_repository, git_log_config, &cfg);\n \n \tif (the_repository->gitdir) {\n \t\tprepare_repo_settings(the_repository);\n@@ -799,7 +799,7 @@ int cmd_show(int argc,\n \n \tmemset(&match_all, 0, sizeof(match_all));\n \trepo_init_revisions(the_repository, &rev, prefix);\n-\tgit_config(grep_config, &rev.grep_filter);\n+\trepo_config(the_repository, grep_config, &rev.grep_filter);\n \n \trev.diff = 1;\n \trev.always_show_header = 1;\n@@ -907,11 +907,11 @@ int cmd_log_reflog(int argc,\n \n \tlog_config_init(&cfg);\n \tinit_diff_ui_defaults();\n-\tgit_config(git_log_config, &cfg);\n+\trepo_config(the_repository, git_log_config, &cfg);\n \n \trepo_init_revisions(the_repository, &rev, prefix);\n \tinit_reflog_walk(&rev.reflog_info);\n-\tgit_config(grep_config, &rev.grep_filter);\n+\trepo_config(the_repository, grep_config, &rev.grep_filter);\n \n \trev.verbose_header = 1;\n \tmemset(&opt, 0, sizeof(opt));\n@@ -952,10 +952,10 @@ int cmd_log(int argc,\n \n \tlog_config_init(&cfg);\n \tinit_diff_ui_defaults();\n-\tgit_config(git_log_config, &cfg);\n+\trepo_config(the_repository, git_log_config, &cfg);\n \n \trepo_init_revisions(the_repository, &rev, prefix);\n-\tgit_config(grep_config, &rev.grep_filter);\n+\trepo_config(the_repository, grep_config, &rev.grep_filter);\n \n \trev.always_show_header = 1;\n \tmemset(&opt, 0, sizeof(opt));\n@@ -2158,9 +2158,9 @@ int cmd_format_patch(int argc,\n \tformat_config_init(&cfg);\n \tinit_diff_ui_defaults();\n \tinit_display_notes(&cfg.notes_opt);\n-\tgit_config(git_format_config, &cfg);\n+\trepo_config(the_repository, git_format_config, &cfg);\n \trepo_init_revisions(the_repository, &rev, prefix);\n-\tgit_config(grep_config, &rev.grep_filter);\n+\trepo_config(the_repository, grep_config, &rev.grep_filter);\n \n \trev.show_notes = cfg.show_notes;\n \tmemcpy(&rev.notes_opt, &cfg.notes_opt, sizeof(cfg.notes_opt));\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex 4d616dd5282..4ba84e51967 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -375,7 +375,7 @@ int cmd_ls_tree(int argc,\n \tstruct object_context obj_context = {0};\n \tint ret;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, ls_tree_options,\n \t\t\t     ls_tree_usage, 0);\ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex 123c81515e1..8fde35c1751 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -167,7 +167,7 @@ int cmd_merge_base(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, options, merge_base_usage, 0);\n \n \tif (cmdmode == 'a') {\ndiff --git a/builtin/merge-file.c b/builtin/merge-file.c\nindex 9464f275629..3da4ca2c8cf 100644\n--- a/builtin/merge-file.c\n+++ b/builtin/merge-file.c\n@@ -97,7 +97,7 @@ int cmd_merge_file(int argc,\n \n \tif (startup_info->have_repository) {\n \t\t/* Read the configuration file */\n-\t\tgit_config(git_xmerge_config, NULL);\n+\t\trepo_config(the_repository, git_xmerge_config, NULL);\n \t\tif (0 <= git_xmerge_style)\n \t\t\txmp.style = git_xmerge_style;\n \t}\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex cf8b06cadc7..99a6495fd52 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -683,7 +683,7 @@ int cmd_merge_tree(int argc,\n \tif (argc != expected_remaining_argc)\n \t\tusage_with_options(merge_tree_usage, mt_options);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \t/* Do the relevant type of merge */\n \tif (o.mode == MODE_REAL)\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 18b22c0a26d..dc4cb8fb14d 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1392,7 +1392,7 @@ int cmd_merge(int argc,\n \t\tskip_prefix(branch, \"refs/heads/\", &branch);\n \n \tinit_diff_ui_defaults();\n-\tgit_config(git_merge_config, NULL);\n+\trepo_config(the_repository, git_merge_config, NULL);\n \n \tif (!branch || is_null_oid(&head_oid))\n \t\thead_commit = NULL;\ndiff --git a/builtin/mktag.c b/builtin/mktag.c\nindex 27e649736cf..e078c97d032 100644\n--- a/builtin/mktag.c\n+++ b/builtin/mktag.c\n@@ -98,7 +98,7 @@ int cmd_mktag(int argc,\n \tfsck_set_msg_type_from_ids(&fsck_options, FSCK_MSG_EXTRA_HEADER_ENTRY,\n \t\t\t\t   FSCK_WARN);\n \t/* config might set fsck.extraHeaderEntry=* again */\n-\tgit_config(git_fsck_config, &fsck_options);\n+\trepo_config(the_repository, git_fsck_config, &fsck_options);\n \tif (fsck_tag_standalone(NULL, buf.buf, buf.len, &fsck_options,\n \t\t\t\t&tagged_oid, &tagged_type))\n \t\tdie(_(\"tag on stdin did not pass our strict fsck check\"));\ndiff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c\nindex aa25b06f9d0..9a113f0f1f3 100644\n--- a/builtin/multi-pack-index.c\n+++ b/builtin/multi-pack-index.c\n@@ -143,7 +143,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,\n \n \topts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;\n \n-\tgit_config(git_multi_pack_index_write_config, NULL);\n+\trepo_config(the_repository, git_multi_pack_index_write_config, NULL);\n \n \toptions = add_common_options(builtin_multi_pack_index_write_options);\n \n@@ -290,7 +290,7 @@ int cmd_multi_pack_index(int argc,\n \n \tdisable_replace_refs();\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tif (the_repository &&\n \t    the_repository->objects &&\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex 07548fe96ae..d43925097b4 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -239,7 +239,7 @@ int cmd_mv(int argc,\n \tstruct strbuf pathbuf = STRBUF_INIT;\n \tint ret;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, builtin_mv_options,\n \t\t\t     builtin_mv_usage, 0);\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex ff199638dee..74512e54a38 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -600,7 +600,7 @@ int cmd_name_rev(int argc,\n \n \tmem_pool_init(&string_pool, 0);\n \tinit_commit_rev_name(&rev_names);\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0);\n \n #ifndef WITH_BREAKING_CHANGES\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex a9529b1696a..17004cdb10e 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -1145,7 +1145,7 @@ int cmd_notes(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, options, git_notes_usage,\n \t\t\t     PARSE_OPT_SUBCOMMAND_OPTIONAL);\n \tif (!fn) {\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 5781dec9808..8c86ec2d89f 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -4924,7 +4924,7 @@ int cmd_pack_objects(int argc,\n \n \treset_pack_idx_option(&pack_idx_opts);\n \tpack_idx_opts.flags |= WRITE_REV;\n-\tgit_config(git_pack_config, NULL);\n+\trepo_config(the_repository, git_pack_config, NULL);\n \tif (git_env_bool(GIT_TEST_NO_WRITE_REV_INDEX, 0))\n \t\tpack_idx_opts.flags &= ~WRITE_REV;\n \ndiff --git a/builtin/patch-id.c b/builtin/patch-id.c\nindex 26f04b0335d..a659f00531a 100644\n--- a/builtin/patch-id.c\n+++ b/builtin/patch-id.c\n@@ -235,7 +235,7 @@ int cmd_patch_id(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_patch_id_config, &config);\n+\trepo_config(the_repository, git_patch_id_config, &config);\n \n \t/* verbatim implies stable */\n \tif (config.verbatim)\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex c593f324fe7..d13ed9b5176 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -999,7 +999,7 @@ int cmd_pull(int argc,\n \tif (!getenv(\"GIT_REFLOG_ACTION\"))\n \t\tset_reflog_message(argc, argv);\n \n-\tgit_config(git_pull_config, NULL);\n+\trepo_config(the_repository, git_pull_config, NULL);\n \tif (the_repository->gitdir) {\n \t\tprepare_repo_settings(the_repository);\n \t\tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 92d530e5c4d..d0794b7b305 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -598,7 +598,7 @@ int cmd_push(int argc,\n \t};\n \n \tpacket_trace_identity(\"push\");\n-\tgit_config(git_push_config, &flags);\n+\trepo_config(the_repository, git_push_config, &flags);\n \targc = parse_options(argc, argv, prefix, options, push_usage, 0);\n \tpush_options = (push_options_cmdline.nr\n \t\t? &push_options_cmdline\ndiff --git a/builtin/range-diff.c b/builtin/range-diff.c\nindex 32ddb6613fb..a563abff5fe 100644\n--- a/builtin/range-diff.c\n+++ b/builtin/range-diff.c\n@@ -54,7 +54,7 @@ int cmd_range_diff(int argc,\n \tstruct object_id oid;\n \tconst char *three_dots = NULL;\n \n-\tgit_config(git_diff_ui_config, NULL);\n+\trepo_config(the_repository, git_diff_ui_config, NULL);\n \n \trepo_diff_setup(the_repository, &diffopt);\n \ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex a8f352f7cd9..00eef756e67 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -168,7 +168,7 @@ int cmd_read_tree(int argc,\n \topts.src_index = the_repository->index;\n \topts.dst_index = the_repository->index;\n \n-\tgit_config(git_read_tree_config, NULL);\n+\trepo_config(the_repository, git_read_tree_config, NULL);\n \n \targc = parse_options(argc, argv, cmd_prefix, read_tree_options,\n \t\t\t     read_tree_usage, 0);\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex e90562a3b8a..0c3daa4b814 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1245,7 +1245,7 @@ int cmd_rebase(int argc,\n \tprepare_repo_settings(the_repository);\n \tthe_repository->settings.command_requires_full_index = 0;\n \n-\tgit_config(rebase_config, &options);\n+\trepo_config(the_repository, rebase_config, &options);\n \t/* options.gpg_sign_opt will be either \"-S\" or NULL */\n \tgpg_sign = options.gpg_sign_opt ? \"\" : NULL;\n \tFREE_AND_NULL(options.gpg_sign_opt);\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 7974d157eb9..82d516a42c4 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -2613,7 +2613,7 @@ int cmd_receive_pack(int argc,\n \tif (!enter_repo(service_dir, 0))\n \t\tdie(\"'%s' does not appear to be a git repository\", service_dir);\n \n-\tgit_config(receive_pack_config, NULL);\n+\trepo_config(the_repository, receive_pack_config, NULL);\n \tif (cert_nonce_seed)\n \t\tpush_cert_nonce = prepare_push_cert_nonce(service_dir, time(NULL));\n \ndiff --git a/builtin/reflog.c b/builtin/reflog.c\nindex 3acaf3e32c2..4312f3d34c9 100644\n--- a/builtin/reflog.c\n+++ b/builtin/reflog.c\n@@ -202,7 +202,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(reflog_expire_config, &opts);\n+\trepo_config(the_repository, reflog_expire_config, &opts);\n \n \tsave_commit_buffer = 0;\n \tdo_all = status = 0;\ndiff --git a/builtin/refs.c b/builtin/refs.c\nindex 998d2a2c1cc..c7ad0a2963a 100644\n--- a/builtin/refs.c\n+++ b/builtin/refs.c\n@@ -88,7 +88,7 @@ static int cmd_refs_verify(int argc, const char **argv, const char *prefix,\n \tif (argc)\n \t\tusage(_(\"'git refs verify' takes no arguments\"));\n \n-\tgit_config(git_fsck_config, &fsck_refs_options);\n+\trepo_config(the_repository, git_fsck_config, &fsck_refs_options);\n \tprepare_repo_settings(the_repository);\n \n \tworktrees = get_worktrees_without_reading_head();\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 18843b6bf6c..ebd70bea3a1 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -353,7 +353,7 @@ static void read_branches(void)\n {\n \tif (branch_list.nr)\n \t\treturn;\n-\tgit_config(config_read_branches, NULL);\n+\trepo_config(the_repository, config_read_branches, NULL);\n }\n \n struct ref_states {\n@@ -690,7 +690,7 @@ static void handle_push_default(const char* old_name, const char* new_name)\n \t\t.origin = STRBUF_INIT,\n \t\t.linenr = -1,\n \t};\n-\tgit_config(config_read_push_default, &push_default);\n+\trepo_config(the_repository, config_read_push_default, &push_default);\n \tif (push_default.scope >= CONFIG_SCOPE_COMMAND)\n \t\t; /* pass */\n \telse if (push_default.scope >= CONFIG_SCOPE_LOCAL) {\n@@ -1620,7 +1620,7 @@ static int update(int argc, const char **argv, const char *prefix,\n \t\tstrvec_push(&cmd.args, argv[i]);\n \n \tif (strcmp(cmd.args.v[cmd.args.nr-1], \"default\") == 0) {\n-\t\tgit_config(get_remote_default, &default_defined);\n+\t\trepo_config(the_repository, get_remote_default, &default_defined);\n \t\tif (!default_defined) {\n \t\t\tstrvec_pop(&cmd.args);\n \t\t\tstrvec_push(&cmd.args, \"--all\");\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex b05ffe46239..dd1db282dac 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -1230,7 +1230,7 @@ int cmd_repack(int argc,\n \n \tlist_objects_filter_init(&po_args.filter_options);\n \n-\tgit_config(repack_config, &cruft_po_args);\n+\trepo_config(the_repository, repack_config, &cruft_po_args);\n \n \targc = parse_options(argc, argv, prefix, builtin_repack_options,\n \t\t\t\tgit_repack_usage, 0);\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 5ff2ab723cb..3fe39e9df73 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -574,7 +574,7 @@ int cmd_replace(int argc,\n \t};\n \n \tdisable_replace_refs();\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, options, git_replace_usage, 0);\n \ndiff --git a/builtin/rerere.c b/builtin/rerere.c\nindex 1312e79d89f..a056cb791b4 100644\n--- a/builtin/rerere.c\n+++ b/builtin/rerere.c\n@@ -66,7 +66,7 @@ int cmd_rerere(int argc,\n \n \targc = parse_options(argc, argv, prefix, options, rerere_usage, 0);\n \n-\tgit_config(git_xmerge_config, NULL);\n+\trepo_config(the_repository, git_xmerge_config, NULL);\n \n \tif (autoupdate == 1)\n \t\tflags = RERERE_AUTOUPDATE;\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex dc50ffc1ac5..00492c19b06 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -377,7 +377,7 @@ int cmd_reset(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_reset_config, NULL);\n+\trepo_config(the_repository, git_reset_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, options, git_reset_usage,\n \t\t\t\t\t\tPARSE_OPT_KEEP_DASHDASH);\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 4d0c460f186..034ea0a558a 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -636,7 +636,7 @@ int cmd_rev_list(int argc,\n \n \tshow_usage_if_asked(argc, argv, rev_list_usage);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \trepo_init_revisions(the_repository, &revs, prefix);\n \trevs.abbrev = DEFAULT_ABBREV;\n \trevs.commit_format = CMIT_FMT_UNSPECIFIED;\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 490da33becc..44ff1b8342a 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -734,7 +734,7 @@ int cmd_rev_parse(int argc,\n \t/* No options; just report on whether we're in a git repo or not. */\n \tif (argc == 1) {\n \t\tsetup_git_directory();\n-\t\tgit_config(git_default_config, NULL);\n+\t\trepo_config(the_repository, git_default_config, NULL);\n \t\treturn 0;\n \t}\n \n@@ -769,7 +769,7 @@ int cmd_rev_parse(int argc,\n \t\t/* The rest of the options require a git repository. */\n \t\tif (!did_repo_setup) {\n \t\t\tprefix = setup_git_directory();\n-\t\t\tgit_config(git_default_config, NULL);\n+\t\t\trepo_config(the_repository, git_default_config, NULL);\n \t\t\tdid_repo_setup = 1;\n \n \t\t\tprepare_repo_settings(the_repository);\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex a6565a69cfc..8c0da7a3ce7 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -271,7 +271,7 @@ int cmd_rm(int argc,\n \tstruct pathspec pathspec;\n \tchar *seen;\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, builtin_rm_options,\n \t\t\t     builtin_rm_usage, 0);\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 60adc5e7a56..b91acf45c8f 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -421,7 +421,7 @@ int cmd_shortlog(int argc,\n \tif (nongit && !the_hash_algo)\n \t\trepo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \tshortlog_init(&log);\n \trepo_init_revisions(the_repository, &rev, prefix);\n \tparse_options_start(&ctx, argc, argv, prefix, options,\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 525b231d87e..1ab7db9d2ca 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -710,7 +710,7 @@ int cmd_show_branch(int ac,\n \n \tinit_commit_name_slab(&name_slab);\n \n-\tgit_config(git_show_branch_config, NULL);\n+\trepo_config(the_repository, git_show_branch_config, NULL);\n \n \t/* If nothing is specified, try the default first */\n \tif (ac == 1 && default_args.nr) {\ndiff --git a/builtin/show-ref.c b/builtin/show-ref.c\nindex 117709cb076..414e55b92d5 100644\n--- a/builtin/show-ref.c\n+++ b/builtin/show-ref.c\n@@ -324,7 +324,7 @@ struct repository *repo UNUSED)\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, show_ref_options,\n \t\t\t     show_ref_usage, 0);\ndiff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c\nindex 1bf01591b27..8c333b3e2e1 100644\n--- a/builtin/sparse-checkout.c\n+++ b/builtin/sparse-checkout.c\n@@ -1082,7 +1082,7 @@ int cmd_sparse_checkout(int argc,\n \t\t\t     builtin_sparse_checkout_options,\n \t\t\t     builtin_sparse_checkout_usage, 0);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tprepare_repo_settings(the_repository);\n \tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex e2f95cc2ebc..821b58a14e5 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -979,7 +979,7 @@ static int show_stash(int argc, const char **argv, const char *prefix,\n \tint do_usage = 0;\n \n \tinit_diff_ui_defaults();\n-\tgit_config(git_diff_ui_config, NULL);\n+\trepo_config(the_repository, git_diff_ui_config, NULL);\n \trepo_init_revisions(the_repository, &rev, prefix);\n \n \targc = parse_options(argc, argv, prefix, options, git_stash_show_usage,\n@@ -2358,7 +2358,7 @@ int cmd_stash(int argc,\n \tconst char **args_copy;\n \tint ret;\n \n-\tgit_config(git_stash_config, NULL);\n+\trepo_config(the_repository, git_stash_config, NULL);\n \n \targc = parse_options(argc, argv, prefix, options, git_stash_usage,\n \t\t\t     PARSE_OPT_SUBCOMMAND_OPTIONAL |\ndiff --git a/builtin/stripspace.c b/builtin/stripspace.c\nindex e147f3ff92c..4a566cbc5de 100644\n--- a/builtin/stripspace.c\n+++ b/builtin/stripspace.c\n@@ -55,7 +55,7 @@ int cmd_stripspace(int argc,\n \n \tif (mode == STRIP_COMMENTS || mode == COMMENT_LINES) {\n \t\tsetup_git_directory_gently(&nongit);\n-\t\tgit_config(git_default_config, NULL);\n+\t\trepo_config(the_repository, git_default_config, NULL);\n \t}\n \n \tif (strbuf_read(&buf, 0, 1024) < 0)\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex d8a6fa47e59..89ee09abea6 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -649,7 +649,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,\n \t\t     \"--ignore-submodules=dirty\", \"--quiet\", \"--\",\n \t\t     path, NULL);\n \n-\tgit_config(git_diff_basic_config, NULL);\n+\trepo_config(the_repository, git_diff_basic_config, NULL);\n \n \trepo_init_revisions(the_repository, &rev, NULL);\n \trev.abbrev = 0;\n@@ -1108,7 +1108,7 @@ static int compute_summary_module_list(struct object_id *head_oid,\n \tif (info->argc)\n \t\tstrvec_pushv(&diff_args, info->argv);\n \n-\tgit_config(git_diff_basic_config, NULL);\n+\trepo_config(the_repository, git_diff_basic_config, NULL);\n \trepo_init_revisions(the_repository, &rev, info->prefix);\n \trev.abbrev = 0;\n \tprecompose_argv_prefix(diff_args.nr, diff_args.v, NULL);\n@@ -2830,7 +2830,7 @@ static int module_update(int argc, const char **argv, const char *prefix,\n \t};\n \n \tupdate_clone_config_from_gitmodules(&opt.max_jobs);\n-\tgit_config(git_update_clone_config, &opt.max_jobs);\n+\trepo_config(the_repository, git_update_clone_config, &opt.max_jobs);\n \n \targc = parse_options(argc, argv, prefix, module_update_options,\n \t\t\t     git_submodule_helper_usage, 0);\n@@ -3128,7 +3128,7 @@ static int module_create_branch(int argc, const char **argv, const char *prefix,\n \t\tNULL\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \ttrack = git_branch_track;\n \targc = parse_options(argc, argv, prefix, options, usage, 0);\n \ndiff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c\nindex 299d23d76a8..5c4623067c5 100644\n--- a/builtin/symbolic-ref.c\n+++ b/builtin/symbolic-ref.c\n@@ -59,7 +59,7 @@ int cmd_symbolic_ref(int argc,\n \t\tOPT_END(),\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, options,\n \t\t\t     git_symbolic_ref_usage, 0);\n \tif (msg && !*msg)\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 46cbf892e34..25f30e3f9be 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -546,7 +546,7 @@ int cmd_tag(int argc,\n \t * Try to set sort keys from config. If config does not set any,\n \t * fall back on default (refname) sorting.\n \t */\n-\tgit_config(git_tag_config, &sorting_options);\n+\trepo_config(the_repository, git_tag_config, &sorting_options);\n \tif (!sorting_options.nr)\n \t\tstring_list_append(&sorting_options, \"refname\");\n \ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex 4360872ae07..ae871adc909 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -43,7 +43,7 @@ int cmd_unpack_file(int argc,\n \tif (repo_get_oid(the_repository, argv[1], &oid))\n \t\tdie(\"Not a valid object name %s\", argv[1]);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tputs(create_temp_file(&oid));\n \treturn 0;\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex a69d59eb50c..26aa885da92 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -621,7 +621,7 @@ int cmd_unpack_objects(int argc,\n \n \tdisable_replace_refs();\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tquiet = !isatty(2);\n \ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex 0c1d4ed55be..2380f3ccd68 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -1103,7 +1103,7 @@ int cmd_update_index(int argc,\n \tshow_usage_with_options_if_asked(argc, argv,\n \t\t\t\t\t update_index_usage, options);\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tprepare_repo_settings(r);\n \tthe_repository->settings.command_requires_full_index = 0;\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex 1e6131e04ad..cb936643243 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -769,7 +769,7 @@ int cmd_update_ref(int argc,\n \t\tOPT_END(),\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, options, git_update_ref_usage,\n \t\t\t     0);\n \tif (msg && !*msg)\ndiff --git a/builtin/var.c b/builtin/var.c\nindex ada642a9fe5..beeac12dccf 100644\n--- a/builtin/var.c\n+++ b/builtin/var.c\n@@ -226,11 +226,11 @@ int cmd_var(int argc,\n \t\tusage(var_usage);\n \n \tif (strcmp(argv[1], \"-l\") == 0) {\n-\t\tgit_config(show_config, NULL);\n+\t\trepo_config(the_repository, show_config, NULL);\n \t\tlist_vars();\n \t\treturn 0;\n \t}\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tgit_var = get_git_var(argv[1]);\n \tif (!git_var)\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex 34e4ed715f3..d9f66f5e767 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -81,7 +81,7 @@ int cmd_verify_pack(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, prefix, verify_pack_options,\n \t\t\t     verify_pack_usage, 0);\n \tif (argc < 1)\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 2dceeeed8bd..b1306248dec 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -1448,7 +1448,7 @@ int cmd_worktree(int ac,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_worktree_config, NULL);\n+\trepo_config(the_repository, git_worktree_config, NULL);\n \n \tif (!prefix)\n \t\tprefix = \"\";\ndiff --git a/builtin/write-tree.c b/builtin/write-tree.c\nindex cfec044710a..3465c70a48a 100644\n--- a/builtin/write-tree.c\n+++ b/builtin/write-tree.c\n@@ -43,7 +43,7 @@ int cmd_write_tree(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \targc = parse_options(argc, argv, cmd_prefix, write_tree_options,\n \t\t\t     write_tree_usage, 0);\n \ndiff --git a/config.h b/config.h\nindex 29a02774837..6b729fc6bbf 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline void git_config(config_fn_t fn, void *data)\n-{\n-\trepo_config(the_repository, fn, data);\n-}\n-\n static inline void git_config_clear(void)\n {\n \trepo_config_clear(the_repository);\ndiff --git a/connect.c b/connect.c\nindex e77287f426c..4b1dc65e5ce 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -1028,7 +1028,7 @@ static int git_proxy_command_options(const char *var, const char *value,\n static int git_use_proxy(const char *host)\n {\n \tgit_proxy_command = getenv(\"GIT_PROXY_COMMAND\");\n-\tgit_config(git_proxy_command_options, (void*)host);\n+\trepo_config(the_repository, git_proxy_command_options, (void*)host);\n \treturn (git_proxy_command && *git_proxy_command);\n }\n \ndiff --git a/contrib/coccinelle/config_fn_ctx.pending.cocci b/contrib/coccinelle/config_fn_ctx.pending.cocci\nindex 6d3d1000a96..54f09fcbcde 100644\n--- a/contrib/coccinelle/config_fn_ctx.pending.cocci\n+++ b/contrib/coccinelle/config_fn_ctx.pending.cocci\n@@ -83,7 +83,7 @@ int fn(const char *C1, const char *C2,\n \n \n // The previous rules don't catch all callbacks, especially if they're defined\n-// in a separate file from the git_config() call. Fix these manually.\n+// in a separate file from the repo_config() call. Fix these manually.\n @@\n identifier C1, C2, D;\n attribute name UNUSED;\ndiff --git a/convert.c b/convert.c\nindex b5f7cf6306c..c7d6a85c226 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -1326,7 +1326,7 @@ void convert_attrs(struct index_state *istate,\n \t\t\t\t\t \"eol\", \"text\", \"working-tree-encoding\",\n \t\t\t\t\t NULL);\n \t\tuser_convert_tail = &user_convert;\n-\t\tgit_config(read_convert_config, NULL);\n+\t\trepo_config(the_repository, read_convert_config, NULL);\n \t}\n \n \tgit_check_attr(istate, path, check);\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 01d3699c4b7..11344206f73 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1916,7 +1916,7 @@ static void fetch_pack_config(void)\n \t\t}\n \t}\n \n-\tgit_config(fetch_pack_config_cb, NULL);\n+\trepo_config(the_repository, fetch_pack_config_cb, NULL);\n }\n \n static void fetch_pack_setup(void)\ndiff --git a/fsck.h b/fsck.h\nindex 0c5869ac34e..dd7df3d5b36 100644\n--- a/fsck.h\n+++ b/fsck.h\n@@ -287,7 +287,7 @@ const char *fsck_describe_object(struct fsck_options *options,\n \n struct key_value_info;\n /*\n- * git_config() callback for use by fsck-y tools that want to support\n+ * repo_config() callback for use by fsck-y tools that want to support\n  * fsck.<msg> fsck.skipList etc.\n  */\n int git_fsck_config(const char *var, const char *value,\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex bdcc8c2a2ed..bc0c21ebab1 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -25,7 +25,7 @@ static void gpg_interface_lazy_init(void)\n \tif (done)\n \t\treturn;\n \tdone = 1;\n-\tgit_config(git_gpg_config, NULL);\n+\trepo_config(the_repository, git_gpg_config, NULL);\n }\n \n static char *configured_signing_key;\ndiff --git a/help.c b/help.c\nindex 652efebf00c..db62cda4442 100644\n--- a/help.c\n+++ b/help.c\n@@ -332,7 +332,7 @@ static int get_colopts(const char *var, const char *value,\n void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds)\n {\n \tunsigned int colopts = 0;\n-\tgit_config(get_colopts, &colopts);\n+\trepo_config(the_repository, get_colopts, &colopts);\n \n \tif (main_cmds->cnt) {\n \t\tconst char *exec_path = git_exec_path();\n@@ -502,7 +502,7 @@ static void list_all_cmds_help_aliases(int longest)\n \tstruct cmdname_help *aliases;\n \tint i;\n \n-\tgit_config(get_alias, &alias_list);\n+\trepo_config(the_repository, get_alias, &alias_list);\n \tstring_list_sort(&alias_list);\n \n \tfor (i = 0; i < alias_list.nr; i++) {\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 02ab80533f0..17b9fe4ff8c 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -150,7 +150,7 @@ int cmd_main(int argc, const char **argv)\n \n \ttrace2_cmd_name(\"http-fetch\");\n \n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tif (packfile) {\n \t\tif (!index_pack_args.nr)\ndiff --git a/http.c b/http.c\nindex 9b62f627dc5..d94e8f63b57 100644\n--- a/http.c\n+++ b/http.c\n@@ -1315,7 +1315,7 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)\n \thttp_is_verbose = 0;\n \tnormalized_url = url_normalize(url, &config.url);\n \n-\tgit_config(urlmatch_config_entry, &config);\n+\trepo_config(the_repository, urlmatch_config_entry, &config);\n \tfree(normalized_url);\n \tstring_list_clear(&config.vars, 1);\n \ndiff --git a/imap-send.c b/imap-send.c\nindex f5a656ac71d..9b26c669c01 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -1776,7 +1776,7 @@ int cmd_main(int argc, const char **argv)\n \tint ret;\n \n \tsetup_git_directory_gently(&nongit_ok);\n-\tgit_config(git_imap_config, &server);\n+\trepo_config(the_repository, git_imap_config, &server);\n \n \targc = parse_options(argc, (const char **)argv, \"\", imap_send_options, imap_send_usage, 0);\n \ndiff --git a/ls-refs.c b/ls-refs.c\nindex e28c8413758..c47acde07f3 100644\n--- a/ls-refs.c\n+++ b/ls-refs.c\n@@ -159,7 +159,7 @@ int ls_refs(struct repository *r, struct packet_reader *request)\n \tstrbuf_init(&data.buf, 0);\n \tstrvec_init(&data.hidden_refs);\n \n-\tgit_config(ls_refs_config, &data);\n+\trepo_config(the_repository, ls_refs_config, &data);\n \n \twhile (packet_reader_read(request) == PACKET_READ_NORMAL) {\n \t\tconst char *arg = request->line;\ndiff --git a/merge-ll.c b/merge-ll.c\nindex b2dc26da4fe..fafe2c91971 100644\n--- a/merge-ll.c\n+++ b/merge-ll.c\n@@ -357,7 +357,7 @@ static void initialize_ll_merge(void)\n \tif (ll_user_merge_tail)\n \t\treturn;\n \tll_user_merge_tail = &ll_user_merge;\n-\tgit_config(read_merge_config, NULL);\n+\trepo_config(the_repository, read_merge_config, NULL);\n }\n \n static const struct ll_merge_driver *find_ll_merge_driver(const char *merge_attr)\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 473ff61e36e..49aa37a8f23 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -5387,7 +5387,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)\n \t\t\tfree(value);\n \t\t}\n \t}\n-\tgit_config(git_xmerge_config, NULL);\n+\trepo_config(the_repository, git_xmerge_config, NULL);\n }\n \n static void init_merge_options(struct merge_options *opt,\ndiff --git a/notes-utils.c b/notes-utils.c\nindex ac66b82dd31..6a50c6d5646 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -162,7 +162,7 @@ struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd)\n \t\tc->refs_from_env = 1;\n \t\tstring_list_add_refs_from_colon_sep(c->refs, rewrite_refs_env);\n \t}\n-\tgit_config(notes_rewrite_config, c);\n+\trepo_config(the_repository, notes_rewrite_config, c);\n \tif (!c->enabled || !c->refs->nr) {\n \t\tstring_list_clear(c->refs, 0);\n \t\tfree(c->refs);\ndiff --git a/notes.c b/notes.c\nindex 97b995f3f2d..49393fbfd8d 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -1123,7 +1123,7 @@ void load_display_notes(struct display_notes_opt *opt)\n \t\t\tload_config_refs = 1;\n \t}\n \n-\tgit_config(notes_display_config, &load_config_refs);\n+\trepo_config(the_repository, notes_display_config, &load_config_refs);\n \n \tif (opt) {\n \t\tstruct string_list_item *item;\ndiff --git a/pretty.c b/pretty.c\nindex 0bc8ad8a9a8..cee96b9d94d 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -141,7 +141,7 @@ static void setup_commit_formats(void)\n \tCOPY_ARRAY(commit_formats, builtin_formats,\n \t\t   ARRAY_SIZE(builtin_formats));\n \n-\tgit_config(git_pretty_formats_config, NULL);\n+\trepo_config(the_repository, git_pretty_formats_config, NULL);\n }\n \n static struct cmt_fmt_map *find_commit_format_recursive(const char *sought,\ndiff --git a/refs/reftable-backend.c b/refs/reftable-backend.c\nindex 4c3817f4ec1..5134781d52d 100644\n--- a/refs/reftable-backend.c\n+++ b/refs/reftable-backend.c\n@@ -386,7 +386,7 @@ static struct ref_store *reftable_be_init(struct repository *repo,\n \trefs->write_options.lock_timeout_ms = 100;\n \trefs->write_options.fsync = reftable_be_fsync;\n \n-\tgit_config(reftable_be_config, &refs->write_options);\n+\trepo_config(the_repository, reftable_be_config, &refs->write_options);\n \n \t/*\n \t * It is somewhat unfortunate that we have to mirror the default block\ndiff --git a/rerere.c b/rerere.c\nindex 8bb97c98229..1ac2075144c 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -879,7 +879,7 @@ static void git_rerere_config(void)\n {\n \tgit_config_get_bool(\"rerere.enabled\", &rerere_enabled);\n \tgit_config_get_bool(\"rerere.autoupdate\", &rerere_autoupdate);\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n }\n \n static GIT_PATH_FUNC(git_path_rr_cache, \"rr-cache\")\n@@ -1247,7 +1247,7 @@ void rerere_gc(struct repository *r, struct string_list *rr)\n \t\t\t\t       &cutoff_resolve, now);\n \trepo_config_get_expiry_in_days(the_repository, \"gc.rerereunresolved\",\n \t\t\t\t       &cutoff_noresolve, now);\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \tdir = opendir(repo_git_path_replace(the_repository, &buf, \"rr-cache\"));\n \tif (!dir)\n \t\tdie_errno(_(\"unable to open rr-cache directory\"));\ndiff --git a/revision.c b/revision.c\nindex 0ca6a297a6b..ad63c100eb9 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1636,7 +1636,7 @@ void exclude_hidden_refs(struct ref_exclusions *exclusions, const char *section)\n \tcb.exclusions = exclusions;\n \tcb.section = section;\n \n-\tgit_config(hide_refs_config, &cb);\n+\trepo_config(the_repository, hide_refs_config, &cb);\n }\n \n struct all_refs_cb {\ndiff --git a/scalar.c b/scalar.c\nindex 0dc79fa9fb0..3b713abca3c 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -713,7 +713,7 @@ static int cmd_reconfigure(int argc, const char **argv)\n \t\t\t    maintenance_str);\n \t}\n \n-\tgit_config(get_scalar_repos, &scalar_repos);\n+\trepo_config(the_repository, get_scalar_repos, &scalar_repos);\n \n \tfor (size_t i = 0; i < scalar_repos.nr; i++) {\n \t\tint succeeded = 0;\ndiff --git a/sequencer.c b/sequencer.c\nindex 67e4310edcf..df207f33e07 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -327,7 +327,7 @@ static int git_sequencer_config(const char *k, const char *v,\n void sequencer_init_config(struct replay_opts *opts)\n {\n \topts->default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE;\n-\tgit_config(git_sequencer_config, opts);\n+\trepo_config(the_repository, git_sequencer_config, opts);\n }\n \n static inline int is_rebase_i(const struct replay_opts *opts)\ndiff --git a/setup.c b/setup.c\nindex 6f52dab64ca..91a3affdd8f 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -2339,7 +2339,7 @@ static int create_default_files(const char *template_path,\n \tcopy_templates(template_path);\n \tgit_config_clear();\n \trepo_settings_reset_shared_repository(the_repository);\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \treinit = is_reinit();\n \n@@ -2610,7 +2610,7 @@ int init_db(const char *git_dir, const char *real_git_dir,\n \t * have set up the repository format such that we can evaluate\n \t * includeIf conditions correctly in the case of re-initialization.\n \t */\n-\tgit_config(platform_core_config, NULL);\n+\trepo_config(the_repository, platform_core_config, NULL);\n \n \tsafe_create_dir(the_repository, git_dir, 0);\n \ndiff --git a/t/helper/test-advise.c b/t/helper/test-advise.c\nindex 6967c8e25c6..77c15a46cfa 100644\n--- a/t/helper/test-advise.c\n+++ b/t/helper/test-advise.c\n@@ -11,7 +11,7 @@ int cmd__advise_if_enabled(int argc, const char **argv)\n \t\tdie(\"usage: %s <advice>\", argv[0]);\n \n \tsetup_git_directory();\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \t/*\n \t * Any advice type can be used for testing, but NESTED_TAG was\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 75e028ab2a0..41ba8647900 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -32,10 +32,10 @@\n  * \t\t\t\tascending order of priority from a config_set\n  * \t\t\t\tconstructed from files entered as arguments.\n  *\n- * iterate -> iterate over all values using git_config(), and print some\n+ * iterate -> iterate over all values using repo_config(), and print some\n  *            data for each\n  *\n- * git_config_int -> iterate over all values using git_config() and print the\n+ * git_config_int -> iterate over all values using repo_config() and print the\n  *                   integer value for the entered key or die\n  *\n  * Examples:\n@@ -218,10 +218,10 @@ int cmd__config(int argc, const char **argv)\n \t\t\tgoto exit1;\n \t\t}\n \t} else if (!strcmp(argv[1], \"iterate\")) {\n-\t\tgit_config(iterate_cb, NULL);\n+\t\trepo_config(the_repository, iterate_cb, NULL);\n \t\tgoto exit0;\n \t} else if (argc == 3 && !strcmp(argv[1], \"git_config_int\")) {\n-\t\tgit_config(parse_int_cb, (void *) argv[2]);\n+\t\trepo_config(the_repository, parse_int_cb, (void *) argv[2]);\n \t\tgoto exit0;\n \t}\n \ndiff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c\nindex e277dde8e71..b2da48eda05 100644\n--- a/t/helper/test-read-cache.c\n+++ b/t/helper/test-read-cache.c\n@@ -19,7 +19,7 @@ int cmd__read_cache(int argc, const char **argv)\n \tif (argc == 2)\n \t\tcnt = strtol(argv[1], NULL, 0);\n \tsetup_git_directory();\n-\tgit_config(git_default_config, NULL);\n+\trepo_config(the_repository, git_default_config, NULL);\n \n \tfor (i = 0; i < cnt; i++) {\n \t\trepo_read_index(the_repository);\ndiff --git a/t/helper/test-userdiff.c b/t/helper/test-userdiff.c\nindex 94c48ababbe..aa3a9894d25 100644\n--- a/t/helper/test-userdiff.c\n+++ b/t/helper/test-userdiff.c\n@@ -41,7 +41,7 @@ int cmd__userdiff(int argc, const char **argv)\n \n \tif (want & USERDIFF_DRIVER_TYPE_CUSTOM) {\n \t\tsetup_git_directory();\n-\t\tgit_config(cmd__userdiff_config, NULL);\n+\t\trepo_config(the_repository, cmd__userdiff_config, NULL);\n \t}\n \n \tfor_each_userdiff_driver(driver_cb, &want);\ndiff --git a/t/t4256/1/mailinfo.c b/t/t4256/1/mailinfo.c\nindex b395adbdf2a..39caeba8653 100644\n--- a/t/t4256/1/mailinfo.c\n+++ b/t/t4256/1/mailinfo.c\n@@ -1214,7 +1214,7 @@ void setup_mailinfo(struct mailinfo *mi)\n \tmi->header_stage = 1;\n \tmi->use_inbody_headers = 1;\n \tmi->content_top = mi->content;\n-\tgit_config(git_mailinfo_config, mi);\n+\trepo_config(the_repository, git_mailinfo_config, mi);\n }\n \n void clear_mailinfo(struct mailinfo *mi)\ndiff --git a/t/t4256/1/mailinfo.c.orig b/t/t4256/1/mailinfo.c.orig\nindex 3281a37d518..b76eb866aae 100644\n--- a/t/t4256/1/mailinfo.c.orig\n+++ b/t/t4256/1/mailinfo.c.orig\n@@ -1154,7 +1154,7 @@ void setup_mailinfo(struct mailinfo *mi)\n \tmi->header_stage = 1;\n \tmi->use_inbody_headers = 1;\n \tmi->content_top = mi->content;\n-\tgit_config(git_mailinfo_config, mi);\n+\trepo_config(the_repository, git_mailinfo_config, mi);\n }\n \n void clear_mailinfo(struct mailinfo *mi)\ndiff --git a/trailer.c b/trailer.c\nindex 310cf582dc3..911a81ed993 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -595,8 +595,8 @@ void trailer_config_init(void)\n \tdefault_conf_info.where = WHERE_END;\n \tdefault_conf_info.if_exists = EXISTS_ADD_IF_DIFFERENT_NEIGHBOR;\n \tdefault_conf_info.if_missing = MISSING_ADD;\n-\tgit_config(git_trailer_default_config, NULL);\n-\tgit_config(git_trailer_config, NULL);\n+\trepo_config(the_repository, git_trailer_default_config, NULL);\n+\trepo_config(the_repository, git_trailer_config, NULL);\n \tconfigured = 1;\n }\n \ndiff --git a/transport.c b/transport.c\nindex c123ac1e38b..a246afd09fa 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -202,7 +202,7 @@ static int fetch_refs_from_bundle(struct transport *transport,\n \tif (!data->get_refs_from_bundle_called)\n \t\tget_refs_from_bundle_inner(transport);\n \n-\tgit_config(fetch_fsck_config_cb, &msg_types);\n+\trepo_config(the_repository, fetch_fsck_config_cb, &msg_types);\n \topts.fsck_msg_types = msg_types.buf;\n \n \tret = unbundle(the_repository, &data->header, data->fd,\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522549","messageId":"20250723-pks-config-wo-the-repository-v2-2-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 02/21] config: drop `git_config_clear()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:23Z","receivedAt":"2025-07-23T14:08:37Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_clear()`. All\ncallsites are adjusted so that they use\n`repo_config_clear(the_repository, ...)` instead. While some callsites\nmight already have a repository available, this mechanical conversion is\nthe exact same as the current situation and thus cannot cause any\nregression. Those sites should eventually be cleaned up in a later patch\nseries.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n config.h | 5 -----\n scalar.c | 2 +-\n setup.c  | 4 ++--\n 3 files changed, 3 insertions(+), 8 deletions(-)\n\ndiff --git a/config.h b/config.h\nindex 6b729fc6bbf..4eea99e9b95 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline void git_config_clear(void)\n-{\n-\trepo_config_clear(the_repository);\n-}\n-\n static inline int git_config_get(const char *key)\n {\n \treturn repo_config_get(the_repository, key);\ndiff --git a/scalar.c b/scalar.c\nindex 3b713abca3c..2aaff5aa109 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -763,7 +763,7 @@ static int cmd_reconfigure(int argc, const char **argv)\n \t\t\tbreak;\n \t\t}\n \n-\t\tgit_config_clear();\n+\t\trepo_config_clear(the_repository);\n \n \t\tif (repo_init(&r, gitdir.buf, commondir.buf))\n \t\t\tgoto loop_end;\ndiff --git a/setup.c b/setup.c\nindex 91a3affdd8f..9661c5d5d5d 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1741,7 +1741,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t * configuration (including the per-repo config file that we\n \t * ignored previously).\n \t */\n-\tgit_config_clear();\n+\trepo_config_clear(the_repository);\n \n \t/*\n \t * Let's assume that we are in a git repository.\n@@ -2337,7 +2337,7 @@ static int create_default_files(const char *template_path,\n \t * disk).\n \t */\n \tcopy_templates(template_path);\n-\tgit_config_clear();\n+\trepo_config_clear(the_repository);\n \trepo_settings_reset_shared_repository(the_repository);\n \trepo_config(the_repository, git_default_config, NULL);\n \n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522550","messageId":"20250723-pks-config-wo-the-repository-v2-3-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 03/21] config: drop `git_config_get()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:24Z","receivedAt":"2025-07-23T14:08:40Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get()`. All\ncallsites are adjusted so that they use `repo_config_get(the_repository,\n...)` instead. While some callsites might already have a repository\navailable, this mechanical conversion is the exact same as the current\nsituation and thus cannot cause any regression. Those sites should\neventually be cleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/gc.c                | 2 +-\n builtin/submodule--helper.c | 6 +++---\n config.h                    | 5 -----\n t/helper/test-config.c      | 2 +-\n 4 files changed, 5 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex d9e3b9d2ec3..e5c3d082eda 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -1916,7 +1916,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,\n \tgit_config_set(\"maintenance.auto\", \"false\");\n \n \t/* Set maintenance strategy, if unset */\n-\tif (git_config_get(\"maintenance.strategy\"))\n+\tif (repo_config_get(the_repository, \"maintenance.strategy\"))\n \t\tgit_config_set(\"maintenance.strategy\", \"incremental\");\n \n \tif (!git_config_get_string_multi(key, &list)) {\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 89ee09abea6..6bcc741a6ac 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -549,7 +549,7 @@ static int module_init(int argc, const char **argv, const char *prefix,\n \t * If there are no path args and submodule.active is set then,\n \t * by default, only initialize 'active' modules.\n \t */\n-\tif (!argc && !git_config_get(\"submodule.active\"))\n+\tif (!argc && !repo_config_get(the_repository, \"submodule.active\"))\n \t\tmodule_list_active(&list);\n \n \tinfo.prefix = prefix;\n@@ -2878,7 +2878,7 @@ static int module_update(int argc, const char **argv, const char *prefix,\n \t\t * If there are no path args and submodule.active is set then,\n \t\t * by default, only initialize 'active' modules.\n \t\t */\n-\t\tif (!argc && !git_config_get(\"submodule.active\"))\n+\t\tif (!argc && !repo_config_get(the_repository, \"submodule.active\"))\n \t\t\tmodule_list_active(&list);\n \n \t\tinfo.prefix = opt.prefix;\n@@ -3349,7 +3349,7 @@ static void configure_added_submodule(struct add_data *add_data)\n \t * is_submodule_active(), since that function needs to find\n \t * out the value of \"submodule.active\" again anyway.\n \t */\n-\tif (!git_config_get(\"submodule.active\")) {\n+\tif (!repo_config_get(the_repository, \"submodule.active\")) {\n \t\t/*\n \t\t * If the submodule being added isn't already covered by the\n \t\t * current configured pathspec, set the submodule's active flag\ndiff --git a/config.h b/config.h\nindex 4eea99e9b95..9261ed0f8d7 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get(const char *key)\n-{\n-\treturn repo_config_get(the_repository, key);\n-}\n-\n static inline int git_config_get_value(const char *key, const char **value)\n {\n \treturn repo_config_get_value(the_repository, key, value);\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 41ba8647900..cacf6f306b1 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -137,7 +137,7 @@ int cmd__config(int argc, const char **argv)\n \t} else if (argc == 3 && !strcmp(argv[1], \"get\")) {\n \t\tint ret;\n \n-\t\tif (!(ret = git_config_get(argv[2])))\n+\t\tif (!(ret = repo_config_get(the_repository, argv[2])))\n \t\t\tgoto exit0;\n \t\telse if (ret == 1)\n \t\t\tprintf(\"Value not found for \\\"%s\\\"\\n\", argv[2]);\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522551","messageId":"20250723-pks-config-wo-the-repository-v2-4-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 04/21] config: drop `git_config_get_value()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:25Z","receivedAt":"2025-07-23T14:08:43Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_value()`. All\ncallsites are adjusted so that they use\n`repo_config_get_value(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/gc.c           | 4 ++--\n builtin/pull.c         | 6 +++---\n config.h               | 5 -----\n rebase-interactive.c   | 2 +-\n t/helper/test-config.c | 2 +-\n 5 files changed, 7 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex e5c3d082eda..e94931ff48f 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -114,7 +114,7 @@ static int gc_config_is_timestamp_never(const char *var)\n \tconst char *value;\n \ttimestamp_t expire;\n \n-\tif (!git_config_get_value(var, &value) && value) {\n+\tif (!repo_config_get_value(the_repository, var, &value) && value) {\n \t\tif (parse_expiry_date(value, &expire))\n \t\t\tdie(_(\"failed to parse '%s' value '%s'\"), var, value);\n \t\treturn expire == 0;\n@@ -178,7 +178,7 @@ static void gc_config(struct gc_config *cfg)\n \tchar *owned = NULL;\n \tunsigned long ulongval;\n \n-\tif (!git_config_get_value(\"gc.packrefs\", &value)) {\n+\tif (!repo_config_get_value(the_repository, \"gc.packrefs\", &value)) {\n \t\tif (value && !strcmp(value, \"notbare\"))\n \t\t\tcfg->pack_refs = -1;\n \t\telse\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex d13ed9b5176..5ea51c31f58 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -312,7 +312,7 @@ static const char *config_get_ff(void)\n {\n \tconst char *value;\n \n-\tif (git_config_get_value(\"pull.ff\", &value))\n+\tif (repo_config_get_value(the_repository, \"pull.ff\", &value))\n \t\treturn NULL;\n \n \tswitch (git_parse_maybe_bool(value)) {\n@@ -343,7 +343,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)\n \tif (curr_branch) {\n \t\tchar *key = xstrfmt(\"branch.%s.rebase\", curr_branch->name);\n \n-\t\tif (!git_config_get_value(key, &value)) {\n+\t\tif (!repo_config_get_value(the_repository, key, &value)) {\n \t\t\tenum rebase_type ret = parse_config_rebase(key, value, 1);\n \t\t\tfree(key);\n \t\t\treturn ret;\n@@ -352,7 +352,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)\n \t\tfree(key);\n \t}\n \n-\tif (!git_config_get_value(\"pull.rebase\", &value))\n+\tif (!repo_config_get_value(the_repository, \"pull.rebase\", &value))\n \t\treturn parse_config_rebase(\"pull.rebase\", value, 1);\n \n \t*rebase_unspecified = 1;\ndiff --git a/config.h b/config.h\nindex 9261ed0f8d7..5dc330b88b1 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_value(const char *key, const char **value)\n-{\n-\treturn repo_config_get_value(the_repository, key, value);\n-}\n-\n static inline int git_config_get_value_multi(const char *key, const struct string_list **dest)\n {\n \treturn repo_config_get_value_multi(the_repository, key, dest);\ndiff --git a/rebase-interactive.c b/rebase-interactive.c\nindex cbeb8641477..809f76a87b8 100644\n--- a/rebase-interactive.c\n+++ b/rebase-interactive.c\n@@ -30,7 +30,7 @@ static enum missing_commit_check_level get_missing_commit_check_level(void)\n {\n \tconst char *value;\n \n-\tif (git_config_get_value(\"rebase.missingcommitscheck\", &value) ||\n+\tif (repo_config_get_value(the_repository, \"rebase.missingcommitscheck\", &value) ||\n \t\t\t!strcasecmp(\"ignore\", value))\n \t\treturn MISSING_COMMIT_CHECK_IGNORE;\n \tif (!strcasecmp(\"warn\", value))\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex cacf6f306b1..99c91512173 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -110,7 +110,7 @@ int cmd__config(int argc, const char **argv)\n \t\tfprintf(stderr, \"Please, provide a command name on the command-line\\n\");\n \t\tgoto exit1;\n \t} else if (argc == 3 && !strcmp(argv[1], \"get_value\")) {\n-\t\tif (!git_config_get_value(argv[2], &v)) {\n+\t\tif (!repo_config_get_value(the_repository, argv[2], &v)) {\n \t\t\tif (!v)\n \t\t\t\tprintf(\"(NULL)\\n\");\n \t\t\telse\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522552","messageId":"20250723-pks-config-wo-the-repository-v2-5-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 05/21] config: drop `git_config_get_value()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:26Z","receivedAt":"2025-07-23T14:08:46Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_value()`. All\ncallsites are adjusted so that they use\n`repo_config_get_value(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n config.h               | 5 -----\n t/helper/test-config.c | 2 +-\n 2 files changed, 1 insertion(+), 6 deletions(-)\n\ndiff --git a/config.h b/config.h\nindex 5dc330b88b1..e90c1c4d335 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_value_multi(const char *key, const struct string_list **dest)\n-{\n-\treturn repo_config_get_value_multi(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_string_multi(const char *key,\n \t\t\t\tconst struct string_list **dest)\n {\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 99c91512173..1953ab846e4 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -121,7 +121,7 @@ int cmd__config(int argc, const char **argv)\n \t\t\tgoto exit1;\n \t\t}\n \t} else if (argc == 3 && !strcmp(argv[1], \"get_value_multi\")) {\n-\t\tif (!git_config_get_value_multi(argv[2], &strptr)) {\n+\t\tif (!repo_config_get_value_multi(the_repository, argv[2], &strptr)) {\n \t\t\tfor (i = 0; i < strptr->nr; i++) {\n \t\t\t\tv = strptr->items[i].string;\n \t\t\t\tif (!v)\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522553","messageId":"20250723-pks-config-wo-the-repository-v2-6-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 06/21] config: drop `git_config_get_string_multi()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:27Z","receivedAt":"2025-07-23T14:08:49Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove\n`git_config_get_string_multi()`. All callsites are adjusted so that they\nuse `repo_config_get_string_multi(the_repository, ...)` instead. While\nsome callsites might already have a repository available, this\nmechanical conversion is the exact same as the current situation and\nthus cannot cause any regression. Those sites should eventually be\ncleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/gc.c  | 4 ++--\n builtin/log.c | 2 +-\n config.h      | 6 ------\n reachable.c   | 2 +-\n versioncmp.c  | 4 ++--\n 5 files changed, 6 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex e94931ff48f..f395cc57a15 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -1919,7 +1919,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,\n \tif (repo_config_get(the_repository, \"maintenance.strategy\"))\n \t\tgit_config_set(\"maintenance.strategy\", \"incremental\");\n \n-\tif (!git_config_get_string_multi(key, &list)) {\n+\tif (!repo_config_get_string_multi(the_repository, key, &list)) {\n \t\tfor_each_string_list_item(item, list) {\n \t\t\tif (!strcmp(maintpath, item->string)) {\n \t\t\t\tfound = 1;\n@@ -1988,7 +1988,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi\n \t}\n \tif (!(config_file\n \t      ? git_configset_get_string_multi(&cs, key, &list)\n-\t      : git_config_get_string_multi(key, &list))) {\n+\t      : repo_config_get_string_multi(the_repository, key, &list))) {\n \t\tfor_each_string_list_item(item, list) {\n \t\t\tif (!strcmp(maintpath, item->string)) {\n \t\t\t\tfound = 1;\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 1bedc4ef355..b512f12e805 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -221,7 +221,7 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f\n \tstruct string_list *include = decoration_filter->include_ref_pattern;\n \tconst struct string_list *config_exclude;\n \n-\tif (!git_config_get_string_multi(\"log.excludeDecoration\",\n+\tif (!repo_config_get_string_multi(the_repository, \"log.excludeDecoration\",\n \t\t\t\t\t &config_exclude)) {\n \t\tstruct string_list_item *item;\n \t\tfor_each_string_list_item(item, config_exclude)\ndiff --git a/config.h b/config.h\nindex e90c1c4d335..f6635e48c23 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,12 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_string_multi(const char *key,\n-\t\t\t\tconst struct string_list **dest)\n-{\n-\treturn repo_config_get_string_multi(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_string(const char *key, char **dest)\n {\n \treturn repo_config_get_string(the_repository, key, dest);\ndiff --git a/reachable.c b/reachable.c\nindex e984b68a0c4..8330a14fa82 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -170,7 +170,7 @@ static void load_gc_recent_objects(struct recent_data *data)\n \n \tdata->extra_recent_oids_loaded = 1;\n \n-\tif (git_config_get_string_multi(\"gc.recentobjectshook\", &programs))\n+\tif (repo_config_get_string_multi(the_repository, \"gc.recentobjectshook\", &programs))\n \t\treturn;\n \n \tfor (i = 0; i < programs->nr; i++) {\ndiff --git a/versioncmp.c b/versioncmp.c\nindex b6eebdb989c..3a81b17bc1b 100644\n--- a/versioncmp.c\n+++ b/versioncmp.c\n@@ -167,8 +167,8 @@ int versioncmp(const char *s1, const char *s2)\n \t\tconst char *const oldk = \"versionsort.prereleasesuffix\";\n \t\tconst struct string_list *newl;\n \t\tconst struct string_list *oldl;\n-\t\tint new = git_config_get_string_multi(newk, &newl);\n-\t\tint old = git_config_get_string_multi(oldk, &oldl);\n+\t\tint new = repo_config_get_string_multi(the_repository, newk, &newl);\n+\t\tint old = repo_config_get_string_multi(the_repository, oldk, &oldl);\n \n \t\tif (!new && !old)\n \t\t\twarning(\"ignoring %s because %s is set\", oldk, newk);\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522554","messageId":"20250723-pks-config-wo-the-repository-v2-7-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 07/21] config: drop `git_config_get_string()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:28Z","receivedAt":"2025-07-23T14:08:52Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_string()`.\nAll callsites are adjusted so that they use\n`repo_config_get_string(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n apply.c                     |  4 ++--\n branch.c                    |  2 +-\n builtin/gc.c                |  4 ++--\n builtin/log.c               |  2 +-\n builtin/notes.c             |  2 +-\n builtin/submodule--helper.c | 12 ++++++------\n config.h                    |  5 -----\n fetch-pack.c                |  2 +-\n merge-ort.c                 |  8 ++++----\n scalar.c                    |  4 ++--\n sequencer.c                 |  2 +-\n transport.c                 |  8 ++++----\n 12 files changed, 25 insertions(+), 30 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex d2381a157c0..45eb790d133 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -48,8 +48,8 @@ struct gitdiff_data {\n \n static void git_apply_config(void)\n {\n-\tgit_config_get_string(\"apply.whitespace\", &apply_default_whitespace);\n-\tgit_config_get_string(\"apply.ignorewhitespace\", &apply_default_ignorewhitespace);\n+\trepo_config_get_string(the_repository, \"apply.whitespace\", &apply_default_whitespace);\n+\trepo_config_get_string(the_repository, \"apply.ignorewhitespace\", &apply_default_ignorewhitespace);\n \trepo_config(the_repository, git_xmerge_config, NULL);\n }\n \ndiff --git a/branch.c b/branch.c\nindex 93f5b4e8dd9..b4811671fc7 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -355,7 +355,7 @@ int read_branch_desc(struct strbuf *buf, const char *branch_name)\n \tchar *v = NULL;\n \tstruct strbuf name = STRBUF_INIT;\n \tstrbuf_addf(&name, \"branch.%s.description\", branch_name);\n-\tif (git_config_get_string(name.buf, &v)) {\n+\tif (repo_config_get_string(the_repository, name.buf, &v)) {\n \t\tstrbuf_release(&name);\n \t\treturn -1;\n \t}\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex f395cc57a15..d8f7a1858cb 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -218,12 +218,12 @@ static void gc_config(struct gc_config *cfg)\n \tif (!git_config_get_ulong(\"core.deltabasecachelimit\", &ulongval))\n \t\tcfg->delta_base_cache_limit = ulongval;\n \n-\tif (!git_config_get_string(\"gc.repackfilter\", &owned)) {\n+\tif (!repo_config_get_string(the_repository, \"gc.repackfilter\", &owned)) {\n \t\tfree(cfg->repack_filter);\n \t\tcfg->repack_filter = owned;\n \t}\n \n-\tif (!git_config_get_string(\"gc.repackfilterto\", &owned)) {\n+\tif (!repo_config_get_string(the_repository, \"gc.repackfilterto\", &owned)) {\n \t\tfree(cfg->repack_filter_to);\n \t\tcfg->repack_filter_to = owned;\n \t}\ndiff --git a/builtin/log.c b/builtin/log.c\nindex b512f12e805..a9969ad00a0 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -235,7 +235,7 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f\n \t * since the command-line takes precedent.\n \t */\n \tif (use_default_decoration_filter &&\n-\t    !git_config_get_string(\"log.initialdecorationset\", &value) &&\n+\t    !repo_config_get_string(the_repository, \"log.initialdecorationset\", &value) &&\n \t    !strcmp(\"all\", value))\n \t\tuse_default_decoration_filter = 0;\n \tfree(value);\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 17004cdb10e..d2252cf5346 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -873,7 +873,7 @@ static int git_config_get_notes_strategy(const char *key,\n {\n \tchar *value;\n \n-\tif (git_config_get_string(key, &value))\n+\tif (repo_config_get_string(the_repository, key, &value))\n \t\treturn 1;\n \tif (parse_notes_merge_strategy(value, strategy))\n \t\tgit_die_config(the_repository, key, _(\"unknown notes merge strategy %s\"), value);\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 6bcc741a6ac..18aa69f0cae 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -53,7 +53,7 @@ static char *resolve_relative_url(const char *rel_url, const char *up_path, int\n \tstruct strbuf remotesb = STRBUF_INIT;\n \n \tstrbuf_addf(&remotesb, \"remote.%s.url\", remote);\n-\tif (git_config_get_string(remotesb.buf, &remoteurl)) {\n+\tif (repo_config_get_string(the_repository, remotesb.buf, &remoteurl)) {\n \t\tif (!quiet)\n \t\t\twarning(_(\"could not look up configuration '%s'. \"\n \t\t\t\t  \"Assuming this repository is its own \"\n@@ -468,7 +468,7 @@ static void init_submodule(const char *path, const char *prefix,\n \t * .gitmodules, so look it up directly.\n \t */\n \tstrbuf_addf(&sb, \"submodule.%s.url\", sub->name);\n-\tif (git_config_get_string(sb.buf, &url)) {\n+\tif (repo_config_get_string(the_repository, sb.buf, &url)) {\n \t\tif (!sub->url)\n \t\t\tdie(_(\"No url found for submodule path '%s' in .gitmodules\"),\n \t\t\t\tdisplaypath);\n@@ -1623,11 +1623,11 @@ static void prepare_possible_alternates(const char *sm_name,\n \tchar *sm_alternate = NULL, *error_strategy = NULL;\n \tstruct submodule_alternate_setup sas = SUBMODULE_ALTERNATE_SETUP_INIT;\n \n-\tgit_config_get_string(\"submodule.alternateLocation\", &sm_alternate);\n+\trepo_config_get_string(the_repository, \"submodule.alternateLocation\", &sm_alternate);\n \tif (!sm_alternate)\n \t\treturn;\n \n-\tgit_config_get_string(\"submodule.alternateErrorStrategy\", &error_strategy);\n+\trepo_config_get_string(the_repository, \"submodule.alternateErrorStrategy\", &error_strategy);\n \n \tif (!error_strategy)\n \t\terror_strategy = xstrdup(\"die\");\n@@ -1808,11 +1808,11 @@ static int clone_submodule(const struct module_clone_data *clone_data,\n \t\tdie(_(\"could not get submodule directory for '%s'\"), clone_data_path);\n \n \t/* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */\n-\tgit_config_get_string(\"submodule.alternateLocation\", &sm_alternate);\n+\trepo_config_get_string(the_repository, \"submodule.alternateLocation\", &sm_alternate);\n \tif (sm_alternate)\n \t\tgit_config_set_in_file(p, \"submodule.alternateLocation\",\n \t\t\t\t       sm_alternate);\n-\tgit_config_get_string(\"submodule.alternateErrorStrategy\", &error_strategy);\n+\trepo_config_get_string(the_repository, \"submodule.alternateErrorStrategy\", &error_strategy);\n \tif (error_strategy)\n \t\tgit_config_set_in_file(p, \"submodule.alternateErrorStrategy\",\n \t\t\t\t       error_strategy);\ndiff --git a/config.h b/config.h\nindex f6635e48c23..8887ebf62ea 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_string(const char *key, char **dest)\n-{\n-\treturn repo_config_get_string(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_string_tmp(const char *key, const char **dest)\n {\n \treturn repo_config_get_string_tmp(the_repository, key, dest);\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 11344206f73..04768087879 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1910,7 +1910,7 @@ static void fetch_pack_config(void)\n \tif (!uri_protocols.nr) {\n \t\tchar *str;\n \n-\t\tif (!git_config_get_string(\"fetch.uriprotocols\", &str) && str) {\n+\t\tif (!repo_config_get_string(the_repository, \"fetch.uriprotocols\", &str) && str) {\n \t\t\tstring_list_split(&uri_protocols, str, ',', -1);\n \t\t\tfree(str);\n \t\t}\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 49aa37a8f23..29789579c9b 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -5358,15 +5358,15 @@ static void merge_recursive_config(struct merge_options *opt, int ui)\n \tgit_config_get_int(\"merge.renamelimit\", &opt->rename_limit);\n \tgit_config_get_bool(\"merge.renormalize\", &renormalize);\n \topt->renormalize = renormalize;\n-\tif (!git_config_get_string(\"diff.renames\", &value)) {\n+\tif (!repo_config_get_string(the_repository, \"diff.renames\", &value)) {\n \t\topt->detect_renames = git_config_rename(\"diff.renames\", value);\n \t\tfree(value);\n \t}\n-\tif (!git_config_get_string(\"merge.renames\", &value)) {\n+\tif (!repo_config_get_string(the_repository, \"merge.renames\", &value)) {\n \t\topt->detect_renames = git_config_rename(\"merge.renames\", value);\n \t\tfree(value);\n \t}\n-\tif (!git_config_get_string(\"merge.directoryrenames\", &value)) {\n+\tif (!repo_config_get_string(the_repository, \"merge.directoryrenames\", &value)) {\n \t\tint boolval = git_parse_maybe_bool(value);\n \t\tif (0 <= boolval) {\n \t\t\topt->detect_directory_renames = boolval ?\n@@ -5379,7 +5379,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)\n \t\tfree(value);\n \t}\n \tif (ui) {\n-\t\tif (!git_config_get_string(\"diff.algorithm\", &value)) {\n+\t\tif (!repo_config_get_string(the_repository, \"diff.algorithm\", &value)) {\n \t\t\tlong diff_algorithm = parse_algorithm_value(value);\n \t\t\tif (diff_algorithm < 0)\n \t\t\t\tdie(_(\"unknown value for config '%s': %s\"), \"diff.algorithm\", value);\ndiff --git a/scalar.c b/scalar.c\nindex 2aaff5aa109..07f855c9913 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -101,7 +101,7 @@ static int set_scalar_config(const struct scalar_config *config, int reconfigure\n \tint res;\n \n \tif ((reconfigure && config->overwrite_on_reconfigure) ||\n-\t    git_config_get_string(config->key, &value)) {\n+\t    repo_config_get_string(the_repository, config->key, &value)) {\n \t\ttrace2_data_string(\"scalar\", the_repository, config->key, \"created\");\n \t\tres = git_config_set_gently(config->key, config->value);\n \t} else {\n@@ -193,7 +193,7 @@ static int set_recommended_config(int reconfigure)\n \t * The `log.excludeDecoration` setting is special because it allows\n \t * for multiple values.\n \t */\n-\tif (git_config_get_string(\"log.excludeDecoration\", &value)) {\n+\tif (repo_config_get_string(the_repository, \"log.excludeDecoration\", &value)) {\n \t\ttrace2_data_string(\"scalar\", the_repository,\n \t\t\t\t   \"log.excludeDecoration\", \"created\");\n \t\tif (git_config_set_multivar_gently(\"log.excludeDecoration\",\ndiff --git a/sequencer.c b/sequencer.c\nindex df207f33e07..f3bada39b40 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -6089,7 +6089,7 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,\n \trevs.topo_order = 1;\n \n \trevs.pretty_given = 1;\n-\tgit_config_get_string(\"rebase.instructionFormat\", &format);\n+\trepo_config_get_string(the_repository, \"rebase.instructionFormat\", &format);\n \tif (!format || !*format) {\n \t\tfree(format);\n \t\tformat = xstrdup(\"# %s\");\ndiff --git a/transport.c b/transport.c\nindex a246afd09fa..89e6297ce22 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -54,14 +54,14 @@ static int transport_color_config(void)\n \t\treturn 0;\n \tinitialized = 1;\n \n-\tif (!git_config_get_string(key, &value))\n+\tif (!repo_config_get_string(the_repository, key, &value))\n \t\ttransport_use_color = git_config_colorbool(key, value);\n \n \tif (!want_color_stderr(transport_use_color))\n \t\treturn 0;\n \n \tfor (size_t i = 0; i < ARRAY_SIZE(keys); i++)\n-\t\tif (!git_config_get_string(keys[i], &value)) {\n+\t\tif (!repo_config_get_string(the_repository, keys[i], &value)) {\n \t\t\tif (!value)\n \t\t\t\treturn config_error_nonbool(keys[i]);\n \t\t\tif (color_parse(value, transport_colors[i]) < 0)\n@@ -1078,7 +1078,7 @@ static enum protocol_allow_config get_protocol_config(const char *type)\n \tchar *value;\n \n \t/* first check the per-protocol config */\n-\tif (!git_config_get_string(key, &value)) {\n+\tif (!repo_config_get_string(the_repository, key, &value)) {\n \t\tenum protocol_allow_config ret =\n \t\t\tparse_protocol_config(key, value);\n \t\tfree(key);\n@@ -1088,7 +1088,7 @@ static enum protocol_allow_config get_protocol_config(const char *type)\n \tfree(key);\n \n \t/* if defined, fallback to user-defined default for unknown protocols */\n-\tif (!git_config_get_string(\"protocol.allow\", &value)) {\n+\tif (!repo_config_get_string(the_repository, \"protocol.allow\", &value)) {\n \t\tenum protocol_allow_config ret =\n \t\t\tparse_protocol_config(\"protocol.allow\", value);\n \t\tfree(value);\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522555","messageId":"20250723-pks-config-wo-the-repository-v2-8-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 08/21] config: drop `git_config_get_string()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:29Z","receivedAt":"2025-07-23T14:08:56Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_string()`.\nAll callsites are adjusted so that they use\n`repo_config_get_string(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/fetch.c             | 2 +-\n builtin/gc.c                | 4 ++--\n builtin/remote.c            | 2 +-\n builtin/submodule--helper.c | 4 ++--\n checkout.c                  | 2 +-\n config.h                    | 5 -----\n connect.c                   | 4 ++--\n editor.c                    | 2 +-\n help.c                      | 2 +-\n promisor-remote.c           | 4 ++--\n protocol.c                  | 2 +-\n remote.c                    | 2 +-\n sideband.c                  | 6 +++---\n t/helper/test-config.c      | 2 +-\n 14 files changed, 19 insertions(+), 24 deletions(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex ea447c453d1..52eae4b972d 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -2508,7 +2508,7 @@ int cmd_fetch(int argc,\n \tif (!max_jobs)\n \t\tmax_jobs = online_cpus();\n \n-\tif (!git_config_get_string_tmp(\"fetch.bundleuri\", &bundle_uri) &&\n+\tif (!repo_config_get_string_tmp(the_repository, \"fetch.bundleuri\", &bundle_uri) &&\n \t    fetch_bundle_uri(the_repository, bundle_uri, NULL))\n \t\twarning(_(\"failed to fetch bundles from '%s'\"), bundle_uri);\n \ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex d8f7a1858cb..a2b8fbc9f3d 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -1765,7 +1765,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,\n \tif (opts->schedule) {\n \t\tstrategy = none_strategy;\n \n-\t\tif (!git_config_get_string_tmp(\"maintenance.strategy\", &config_str)) {\n+\t\tif (!repo_config_get_string_tmp(the_repository, \"maintenance.strategy\", &config_str)) {\n \t\t\tif (!strcasecmp(config_str, \"incremental\"))\n \t\t\t\tstrategy = incremental_strategy;\n \t\t}\n@@ -1788,7 +1788,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,\n \t\t\tstrbuf_reset(&config_name);\n \t\t\tstrbuf_addf(&config_name, \"maintenance.%s.schedule\",\n \t\t\t\t    tasks[i].name);\n-\t\t\tif (!git_config_get_string_tmp(config_name.buf, &config_str))\n+\t\t\tif (!repo_config_get_string_tmp(the_repository, config_name.buf, &config_str))\n \t\t\t\tstrategy.tasks[i].schedule = parse_schedule(config_str);\n \t\t\tif (strategy.tasks[i].schedule < opts->schedule)\n \t\t\t\tcontinue;\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex ebd70bea3a1..826b2dcfd04 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -1268,7 +1268,7 @@ static int get_one_entry(struct remote *remote, void *priv)\n \n \t\tstrbuf_addf(&promisor_config, \"remote.%s.partialclonefilter\", remote->name);\n \t\tstrbuf_addf(&remote_info_buf, \"%s (fetch)\", remote->url.v[0]);\n-\t\tif (!git_config_get_string_tmp(promisor_config.buf, &partial_clone_filter))\n+\t\tif (!repo_config_get_string_tmp(the_repository, promisor_config.buf, &partial_clone_filter))\n \t\t\tstrbuf_addf(&remote_info_buf, \" [%s]\", partial_clone_filter);\n \n \t\tstrbuf_release(&promisor_config);\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 18aa69f0cae..d2ab31835b5 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -496,7 +496,7 @@ static void init_submodule(const char *path, const char *prefix,\n \n \t/* Copy \"update\" setting when it is not set yet */\n \tstrbuf_addf(&sb, \"submodule.%s.update\", sub->name);\n-\tif (git_config_get_string_tmp(sb.buf, &upd) &&\n+\tif (repo_config_get_string_tmp(the_repository, sb.buf, &upd) &&\n \t    sub->update_strategy.type != SM_UPDATE_UNSPECIFIED) {\n \t\tif (sub->update_strategy.type == SM_UPDATE_COMMAND) {\n \t\t\tfprintf(stderr, _(\"warning: command update mode suggested for submodule '%s'\\n\"),\n@@ -1034,7 +1034,7 @@ static void prepare_submodule_summary(struct summary_cb *info,\n \n \t\t\tconfig_key = xstrfmt(\"submodule.%s.ignore\",\n \t\t\t\t\t     sub->name);\n-\t\t\tif (!git_config_get_string_tmp(config_key, &value))\n+\t\t\tif (!repo_config_get_string_tmp(the_repository, config_key, &value))\n \t\t\t\tignore_all = !strcmp(value, \"all\");\n \t\t\telse if (sub->ignore)\n \t\t\t\tignore_all = !strcmp(sub->ignore, \"all\");\ndiff --git a/checkout.c b/checkout.c\nindex 0b1cf8b40b7..1588b116eed 100644\n--- a/checkout.c\n+++ b/checkout.c\n@@ -52,7 +52,7 @@ char *unique_tracking_name(const char *name, struct object_id *oid,\n {\n \tstruct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT;\n \tconst char *default_remote = NULL;\n-\tif (!git_config_get_string_tmp(\"checkout.defaultremote\", &default_remote))\n+\tif (!repo_config_get_string_tmp(the_repository, \"checkout.defaultremote\", &default_remote))\n \t\tcb_data.default_remote = default_remote;\n \tcb_data.src_ref = xstrfmt(\"refs/heads/%s\", name);\n \tcb_data.dst_oid = oid;\ndiff --git a/config.h b/config.h\nindex 8887ebf62ea..89739bee9b0 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_string_tmp(const char *key, const char **dest)\n-{\n-\treturn repo_config_get_string_tmp(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_int(const char *key, int *dest)\n {\n \treturn repo_config_get_int(the_repository, key, dest);\ndiff --git a/connect.c b/connect.c\nindex 4b1dc65e5ce..34cac24d54c 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -1154,7 +1154,7 @@ static const char *get_ssh_command(void)\n \tif ((ssh = getenv(\"GIT_SSH_COMMAND\")))\n \t\treturn ssh;\n \n-\tif (!git_config_get_string_tmp(\"core.sshcommand\", &ssh))\n+\tif (!repo_config_get_string_tmp(the_repository, \"core.sshcommand\", &ssh))\n \t\treturn ssh;\n \n \treturn NULL;\n@@ -1173,7 +1173,7 @@ static void override_ssh_variant(enum ssh_variant *ssh_variant)\n {\n \tconst char *variant = getenv(\"GIT_SSH_VARIANT\");\n \n-\tif (!variant && git_config_get_string_tmp(\"ssh.variant\", &variant))\n+\tif (!variant && repo_config_get_string_tmp(the_repository, \"ssh.variant\", &variant))\n \t\treturn;\n \n \tif (!strcmp(variant, \"auto\"))\ndiff --git a/editor.c b/editor.c\nindex b79d97b0e72..fd174e6a034 100644\n--- a/editor.c\n+++ b/editor.c\n@@ -50,7 +50,7 @@ const char *git_sequence_editor(void)\n \tconst char *editor = getenv(\"GIT_SEQUENCE_EDITOR\");\n \n \tif (!editor)\n-\t\tgit_config_get_string_tmp(\"sequence.editor\", &editor);\n+\t\trepo_config_get_string_tmp(the_repository, \"sequence.editor\", &editor);\n \tif (!editor)\n \t\teditor = git_editor();\n \ndiff --git a/help.c b/help.c\nindex db62cda4442..bb20498cfd0 100644\n--- a/help.c\n+++ b/help.c\n@@ -417,7 +417,7 @@ void list_cmds_by_config(struct string_list *list)\n {\n \tconst char *cmd_list;\n \n-\tif (git_config_get_string_tmp(\"completion.commands\", &cmd_list))\n+\tif (repo_config_get_string_tmp(the_repository, \"completion.commands\", &cmd_list))\n \t\treturn;\n \n \tstring_list_sort(list);\ndiff --git a/promisor-remote.c b/promisor-remote.c\nindex be6f82d12f8..a9c877d9cfa 100644\n--- a/promisor-remote.c\n+++ b/promisor-remote.c\n@@ -327,7 +327,7 @@ static void promisor_info_vecs(struct repository *repo,\n \t\tchar *url_key = xstrfmt(\"remote.%s.url\", r->name);\n \n \t\t/* Only add remotes with a non empty URL */\n-\t\tif (!git_config_get_string_tmp(url_key, &url) && *url) {\n+\t\tif (!repo_config_get_string_tmp(the_repository, url_key, &url) && *url) {\n \t\t\tstrvec_push(names, r->name);\n \t\t\tstrvec_push(urls, url);\n \t\t}\n@@ -433,7 +433,7 @@ static void filter_promisor_remote(struct repository *repo,\n \tstruct strvec names = STRVEC_INIT;\n \tstruct strvec urls = STRVEC_INIT;\n \n-\tif (!git_config_get_string_tmp(\"promisor.acceptfromserver\", &accept_str)) {\n+\tif (!repo_config_get_string_tmp(the_repository, \"promisor.acceptfromserver\", &accept_str)) {\n \t\tif (!*accept_str || !strcasecmp(\"None\", accept_str))\n \t\t\taccept = ACCEPT_NONE;\n \t\telse if (!strcasecmp(\"KnownUrl\", accept_str))\ndiff --git a/protocol.c b/protocol.c\nindex bae7226ff40..65f66217021 100644\n--- a/protocol.c\n+++ b/protocol.c\n@@ -24,7 +24,7 @@ enum protocol_version get_protocol_version_config(void)\n \tconst char *git_test_k = \"GIT_TEST_PROTOCOL_VERSION\";\n \tconst char *git_test_v;\n \n-\tif (!git_config_get_string_tmp(\"protocol.version\", &value)) {\n+\tif (!repo_config_get_string_tmp(the_repository, \"protocol.version\", &value)) {\n \t\tenum protocol_version version = parse_protocol_version(value);\n \n \t\tif (version == protocol_unknown_version)\ndiff --git a/remote.c b/remote.c\nindex e965f022f12..88f991795b2 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -734,7 +734,7 @@ static void validate_remote_url(struct remote *remote)\n \tstruct strbuf redacted = STRBUF_INIT;\n \tint warn_not_die;\n \n-\tif (git_config_get_string_tmp(\"transfer.credentialsinurl\", &value))\n+\tif (repo_config_get_string_tmp(the_repository, \"transfer.credentialsinurl\", &value))\n \t\treturn;\n \n \tif (!strcmp(\"warn\", value))\ndiff --git a/sideband.c b/sideband.c\nindex 251e9615ed0..8f15b98a654 100644\n--- a/sideband.c\n+++ b/sideband.c\n@@ -39,9 +39,9 @@ static int use_sideband_colors(void)\n \tif (use_sideband_colors_cached >= 0)\n \t\treturn use_sideband_colors_cached;\n \n-\tif (!git_config_get_string_tmp(key, &value))\n+\tif (!repo_config_get_string_tmp(the_repository, key, &value))\n \t\tuse_sideband_colors_cached = git_config_colorbool(key, value);\n-\telse if (!git_config_get_string_tmp(\"color.ui\", &value))\n+\telse if (!repo_config_get_string_tmp(the_repository, \"color.ui\", &value))\n \t\tuse_sideband_colors_cached = git_config_colorbool(\"color.ui\", value);\n \telse\n \t\tuse_sideband_colors_cached = GIT_COLOR_AUTO;\n@@ -49,7 +49,7 @@ static int use_sideband_colors(void)\n \tfor (i = 0; i < ARRAY_SIZE(keywords); i++) {\n \t\tstrbuf_reset(&sb);\n \t\tstrbuf_addf(&sb, \"%s.%s\", key, keywords[i].keyword);\n-\t\tif (git_config_get_string_tmp(sb.buf, &value))\n+\t\tif (repo_config_get_string_tmp(the_repository, sb.buf, &value))\n \t\t\tcontinue;\n \t\tcolor_parse(value, keywords[i].color);\n \t}\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 1953ab846e4..30e70f1a6c2 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -171,7 +171,7 @@ int cmd__config(int argc, const char **argv)\n \t\t\tgoto exit1;\n \t\t}\n \t} else if (argc == 3 && !strcmp(argv[1], \"get_string\")) {\n-\t\tif (!git_config_get_string_tmp(argv[2], &v)) {\n+\t\tif (!repo_config_get_string_tmp(the_repository, argv[2], &v)) {\n \t\t\tprintf(\"%s\\n\", v);\n \t\t\tgoto exit0;\n \t\t} else {\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522556","messageId":"20250723-pks-config-wo-the-repository-v2-9-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 09/21] config: drop `git_config_get_int()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:30Z","receivedAt":"2025-07-23T14:08:59Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_int()`. All\ncallsites are adjusted so that they use\n`repo_config_get_int(the_repository, ...)` instead. While some callsites\nmight already have a repository available, this mechanical conversion is\nthe exact same as the current situation and thus cannot cause any\nregression. Those sites should eventually be cleaned up in a later patch\nseries.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/credential-store.c |  2 +-\n builtin/fast-import.c      |  6 +++---\n builtin/fetch.c            |  4 ++--\n builtin/gc.c               | 26 +++++++++++++-------------\n config.h                   |  5 -----\n fetch-pack.c               |  4 ++--\n fsmonitor.c                |  2 +-\n merge-ort.c                |  6 +++---\n parallel-checkout.c        |  4 ++--\n refs.c                     |  2 +-\n refs/packed-backend.c      |  2 +-\n sequencer.c                |  2 +-\n t/helper/test-config.c     |  2 +-\n 13 files changed, 31 insertions(+), 36 deletions(-)\n\ndiff --git a/builtin/credential-store.c b/builtin/credential-store.c\nindex e669e99dbfb..b74e06cc93d 100644\n--- a/builtin/credential-store.c\n+++ b/builtin/credential-store.c\n@@ -66,7 +66,7 @@ static void rewrite_credential_file(const char *fn, struct credential *c,\n {\n \tint timeout_ms = 1000;\n \n-\tgit_config_get_int(\"credentialstore.locktimeoutms\", &timeout_ms);\n+\trepo_config_get_int(the_repository, \"credentialstore.locktimeoutms\", &timeout_ms);\n \tif (hold_lock_file_for_update_timeout(&credential_lock, fn, 0, timeout_ms) < 0)\n \t\tdie_errno(_(\"unable to get credential storage lock in %d ms\"), timeout_ms);\n \tif (extra)\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 607441e921b..9b0ae437148 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -3527,7 +3527,7 @@ static void git_pack_config(void)\n \t\tif (max_depth > MAX_DEPTH)\n \t\t\tmax_depth = MAX_DEPTH;\n \t}\n-\tif (!git_config_get_int(\"pack.indexversion\", &indexversion_value)) {\n+\tif (!repo_config_get_int(the_repository, \"pack.indexversion\", &indexversion_value)) {\n \t\tpack_idx_opts.version = indexversion_value;\n \t\tif (pack_idx_opts.version > 2)\n \t\t\tgit_die_config(the_repository, \"pack.indexversion\",\n@@ -3536,9 +3536,9 @@ static void git_pack_config(void)\n \tif (!git_config_get_ulong(\"pack.packsizelimit\", &packsizelimit_value))\n \t\tmax_packsize = packsizelimit_value;\n \n-\tif (!git_config_get_int(\"fastimport.unpacklimit\", &limit))\n+\tif (!repo_config_get_int(the_repository, \"fastimport.unpacklimit\", &limit))\n \t\tunpack_limit = limit;\n-\telse if (!git_config_get_int(\"transfer.unpacklimit\", &limit))\n+\telse if (!repo_config_get_int(the_repository, \"transfer.unpacklimit\", &limit))\n \t\tunpack_limit = limit;\n \n \trepo_config(the_repository, git_default_config, NULL);\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 52eae4b972d..24645c46533 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -2683,12 +2683,12 @@ int cmd_fetch(int argc,\n \t\t\t * but respect config settings disabling it.\n \t\t\t */\n \t\t\tint opt_val;\n-\t\t\tif (git_config_get_int(\"gc.autopacklimit\", &opt_val))\n+\t\t\tif (repo_config_get_int(the_repository, \"gc.autopacklimit\", &opt_val))\n \t\t\t\topt_val = -1;\n \t\t\tif (opt_val != 0)\n \t\t\t\tgit_config_push_parameter(\"gc.autoPackLimit=1\");\n \n-\t\t\tif (git_config_get_int(\"maintenance.incremental-repack.auto\", &opt_val))\n+\t\t\tif (repo_config_get_int(the_repository, \"maintenance.incremental-repack.auto\", &opt_val))\n \t\t\t\topt_val = -1;\n \t\t\tif (opt_val != 0)\n \t\t\t\tgit_config_push_parameter(\"maintenance.incremental-repack.auto=-1\");\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex a2b8fbc9f3d..cf175b8f1b7 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -189,10 +189,10 @@ static void gc_config(struct gc_config *cfg)\n \t    gc_config_is_timestamp_never(\"gc.reflogexpireunreachable\"))\n \t\tcfg->prune_reflogs = 0;\n \n-\tgit_config_get_int(\"gc.aggressivewindow\", &cfg->aggressive_window);\n-\tgit_config_get_int(\"gc.aggressivedepth\", &cfg->aggressive_depth);\n-\tgit_config_get_int(\"gc.auto\", &cfg->gc_auto_threshold);\n-\tgit_config_get_int(\"gc.autopacklimit\", &cfg->gc_auto_pack_limit);\n+\trepo_config_get_int(the_repository, \"gc.aggressivewindow\", &cfg->aggressive_window);\n+\trepo_config_get_int(the_repository, \"gc.aggressivedepth\", &cfg->aggressive_depth);\n+\trepo_config_get_int(the_repository, \"gc.auto\", &cfg->gc_auto_threshold);\n+\trepo_config_get_int(the_repository, \"gc.autopacklimit\", &cfg->gc_auto_pack_limit);\n \tgit_config_get_bool(\"gc.autodetach\", &cfg->detach_auto);\n \tgit_config_get_bool(\"gc.cruftpacks\", &cfg->cruft_packs);\n \tgit_config_get_ulong(\"gc.maxcruftsize\", &cfg->max_cruft_size);\n@@ -332,7 +332,7 @@ static int reflog_expire_condition(struct gc_config *cfg UNUSED)\n \t};\n \tint limit = 100;\n \n-\tgit_config_get_int(\"maintenance.reflog-expire.auto\", &limit);\n+\trepo_config_get_int(the_repository, \"maintenance.reflog-expire.auto\", &limit);\n \tif (!limit)\n \t\treturn 0;\n \tif (limit < 0)\n@@ -378,7 +378,7 @@ static int worktree_prune_condition(struct gc_config *cfg)\n \tstruct dirent *d;\n \tDIR *dir = NULL;\n \n-\tgit_config_get_int(\"maintenance.worktree-prune.auto\", &limit);\n+\trepo_config_get_int(the_repository, \"maintenance.worktree-prune.auto\", &limit);\n \tif (limit <= 0) {\n \t\tshould_prune = limit < 0;\n \t\tgoto out;\n@@ -423,7 +423,7 @@ static int rerere_gc_condition(struct gc_config *cfg UNUSED)\n \tint should_gc = 0, limit = 1;\n \tDIR *dir = NULL;\n \n-\tgit_config_get_int(\"maintenance.rerere-gc.auto\", &limit);\n+\trepo_config_get_int(the_repository, \"maintenance.rerere-gc.auto\", &limit);\n \tif (limit <= 0) {\n \t\tshould_gc = limit < 0;\n \t\tgoto out;\n@@ -1161,8 +1161,8 @@ static int should_write_commit_graph(struct gc_config *cfg UNUSED)\n \n \tdata.num_not_in_graph = 0;\n \tdata.limit = 100;\n-\tgit_config_get_int(\"maintenance.commit-graph.auto\",\n-\t\t\t   &data.limit);\n+\trepo_config_get_int(the_repository, \"maintenance.commit-graph.auto\",\n+\t\t\t    &data.limit);\n \n \tif (!data.limit)\n \t\treturn 0;\n@@ -1300,8 +1300,8 @@ static int loose_object_auto_condition(struct gc_config *cfg UNUSED)\n {\n \tint count = 0;\n \n-\tgit_config_get_int(\"maintenance.loose-objects.auto\",\n-\t\t\t   &loose_object_auto_limit);\n+\trepo_config_get_int(the_repository, \"maintenance.loose-objects.auto\",\n+\t\t\t    &loose_object_auto_limit);\n \n \tif (!loose_object_auto_limit)\n \t\treturn 0;\n@@ -1415,8 +1415,8 @@ static int incremental_repack_auto_condition(struct gc_config *cfg UNUSED)\n \tif (!the_repository->settings.core_multi_pack_index)\n \t\treturn 0;\n \n-\tgit_config_get_int(\"maintenance.incremental-repack.auto\",\n-\t\t\t   &incremental_repack_auto_limit);\n+\trepo_config_get_int(the_repository, \"maintenance.incremental-repack.auto\",\n+\t\t\t    &incremental_repack_auto_limit);\n \n \tif (!incremental_repack_auto_limit)\n \t\treturn 0;\ndiff --git a/config.h b/config.h\nindex 89739bee9b0..2490c47daaf 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_int(const char *key, int *dest)\n-{\n-\treturn repo_config_get_int(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_ulong(const char *key, unsigned long *dest)\n {\n \treturn repo_config_get_ulong(the_repository, key, dest);\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 04768087879..1f184efb3c9 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1901,8 +1901,8 @@ static int fetch_pack_config_cb(const char *var, const char *value,\n \n static void fetch_pack_config(void)\n {\n-\tgit_config_get_int(\"fetch.unpacklimit\", &fetch_unpack_limit);\n-\tgit_config_get_int(\"transfer.unpacklimit\", &transfer_unpack_limit);\n+\trepo_config_get_int(the_repository, \"fetch.unpacklimit\", &fetch_unpack_limit);\n+\trepo_config_get_int(the_repository, \"transfer.unpacklimit\", &transfer_unpack_limit);\n \tgit_config_get_bool(\"repack.usedeltabaseoffset\", &prefer_ofs_delta);\n \tgit_config_get_bool(\"fetch.fsckobjects\", &fetch_fsck_objects);\n \tgit_config_get_bool(\"transfer.fsckobjects\", &transfer_fsck_objects);\ndiff --git a/fsmonitor.c b/fsmonitor.c\nindex 98b2b476f08..d07dc18967a 100644\n--- a/fsmonitor.c\n+++ b/fsmonitor.c\n@@ -43,7 +43,7 @@ static int fsmonitor_hook_version(void)\n {\n \tint hook_version;\n \n-\tif (git_config_get_int(\"core.fsmonitorhookversion\", &hook_version))\n+\tif (repo_config_get_int(the_repository, \"core.fsmonitorhookversion\", &hook_version))\n \t\treturn -1;\n \n \tif (hook_version == HOOK_INTERFACE_VERSION1 ||\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 29789579c9b..45fd41f8dfd 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -5353,9 +5353,9 @@ static void merge_recursive_config(struct merge_options *opt, int ui)\n {\n \tchar *value = NULL;\n \tint renormalize = 0;\n-\tgit_config_get_int(\"merge.verbosity\", &opt->verbosity);\n-\tgit_config_get_int(\"diff.renamelimit\", &opt->rename_limit);\n-\tgit_config_get_int(\"merge.renamelimit\", &opt->rename_limit);\n+\trepo_config_get_int(the_repository, \"merge.verbosity\", &opt->verbosity);\n+\trepo_config_get_int(the_repository, \"diff.renamelimit\", &opt->rename_limit);\n+\trepo_config_get_int(the_repository, \"merge.renamelimit\", &opt->rename_limit);\n \tgit_config_get_bool(\"merge.renormalize\", &renormalize);\n \topt->renormalize = renormalize;\n \tif (!repo_config_get_string(the_repository, \"diff.renames\", &value)) {\ndiff --git a/parallel-checkout.c b/parallel-checkout.c\nindex 57c2dcaa8f6..fba6aa65a6e 100644\n--- a/parallel-checkout.c\n+++ b/parallel-checkout.c\n@@ -57,12 +57,12 @@ void get_parallel_checkout_configs(int *num_workers, int *threshold)\n \t\treturn;\n \t}\n \n-\tif (git_config_get_int(\"checkout.workers\", num_workers))\n+\tif (repo_config_get_int(the_repository, \"checkout.workers\", num_workers))\n \t\t*num_workers = DEFAULT_NUM_WORKERS;\n \telse if (*num_workers < 1)\n \t\t*num_workers = online_cpus();\n \n-\tif (git_config_get_int(\"checkout.thresholdForParallelism\", threshold))\n+\tif (repo_config_get_int(the_repository, \"checkout.thresholdForParallelism\", threshold))\n \t\t*threshold = DEFAULT_THRESHOLD_FOR_PARALLELISM;\n }\n \ndiff --git a/refs.c b/refs.c\nindex 73913b6627b..777cbd34ebc 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -945,7 +945,7 @@ long get_files_ref_lock_timeout_ms(void)\n \tstatic int timeout_ms = 100;\n \n \tif (!configured) {\n-\t\tgit_config_get_int(\"core.filesreflocktimeout\", &timeout_ms);\n+\t\trepo_config_get_int(the_repository, \"core.filesreflocktimeout\", &timeout_ms);\n \t\tconfigured = 1;\n \t}\n \ndiff --git a/refs/packed-backend.c b/refs/packed-backend.c\nindex 7fd73a0e6da..7dd26726b1e 100644\n--- a/refs/packed-backend.c\n+++ b/refs/packed-backend.c\n@@ -1228,7 +1228,7 @@ int packed_refs_lock(struct ref_store *ref_store, int flags, struct strbuf *err)\n \tstatic int timeout_value = 1000;\n \n \tif (!timeout_configured) {\n-\t\tgit_config_get_int(\"core.packedrefstimeout\", &timeout_value);\n+\t\trepo_config_get_int(the_repository, \"core.packedrefstimeout\", &timeout_value);\n \t\ttimeout_configured = 1;\n \t}\n \ndiff --git a/sequencer.c b/sequencer.c\nindex f3bada39b40..f8d9bb69df8 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -5834,7 +5834,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,\n \t\t*cmd_reset = abbr ? \"t\" : \"reset\",\n \t\t*cmd_merge = abbr ? \"m\" : \"merge\";\n \n-\tgit_config_get_int(\"rebase.maxlabellength\", &state.max_label_length);\n+\trepo_config_get_int(the_repository, \"rebase.maxlabellength\", &state.max_label_length);\n \n \toidmap_init(&commit2todo, 0);\n \toidmap_init(&state.commit2label, 0);\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 30e70f1a6c2..ce1e3330516 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -155,7 +155,7 @@ int cmd__config(int argc, const char **argv)\n \t\t\tBUG(\"Key \\\"%s\\\" has unknown return %d\", argv[2], ret);\n \t\tgoto exit1;\n \t} else if (argc == 3 && !strcmp(argv[1], \"get_int\")) {\n-\t\tif (!git_config_get_int(argv[2], &val)) {\n+\t\tif (!repo_config_get_int(the_repository, argv[2], &val)) {\n \t\t\tprintf(\"%d\\n\", val);\n \t\t\tgoto exit0;\n \t\t} else {\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522557","messageId":"20250723-pks-config-wo-the-repository-v2-10-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 10/21] config: drop `git_config_get_ulong()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:31Z","receivedAt":"2025-07-23T14:09:02Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_ulong()`. All\ncallsites are adjusted so that they use\n`repo_config_get_ulong(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/fast-import.c |  4 ++--\n builtin/gc.c          | 10 +++++-----\n config.h              |  5 -----\n http-backend.c        |  2 +-\n 4 files changed, 8 insertions(+), 13 deletions(-)\n\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 9b0ae437148..a3f7f14f4fe 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -3523,7 +3523,7 @@ static void git_pack_config(void)\n \tint limit;\n \tunsigned long packsizelimit_value;\n \n-\tif (!git_config_get_ulong(\"pack.depth\", &max_depth)) {\n+\tif (!repo_config_get_ulong(the_repository, \"pack.depth\", &max_depth)) {\n \t\tif (max_depth > MAX_DEPTH)\n \t\t\tmax_depth = MAX_DEPTH;\n \t}\n@@ -3533,7 +3533,7 @@ static void git_pack_config(void)\n \t\t\tgit_die_config(the_repository, \"pack.indexversion\",\n \t\t\t\t       \"bad pack.indexVersion=%\"PRIu32, pack_idx_opts.version);\n \t}\n-\tif (!git_config_get_ulong(\"pack.packsizelimit\", &packsizelimit_value))\n+\tif (!repo_config_get_ulong(the_repository, \"pack.packsizelimit\", &packsizelimit_value))\n \t\tmax_packsize = packsizelimit_value;\n \n \tif (!repo_config_get_int(the_repository, \"fastimport.unpacklimit\", &limit))\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex cf175b8f1b7..d15daf59625 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -195,7 +195,7 @@ static void gc_config(struct gc_config *cfg)\n \trepo_config_get_int(the_repository, \"gc.autopacklimit\", &cfg->gc_auto_pack_limit);\n \tgit_config_get_bool(\"gc.autodetach\", &cfg->detach_auto);\n \tgit_config_get_bool(\"gc.cruftpacks\", &cfg->cruft_packs);\n-\tgit_config_get_ulong(\"gc.maxcruftsize\", &cfg->max_cruft_size);\n+\trepo_config_get_ulong(the_repository, \"gc.maxcruftsize\", &cfg->max_cruft_size);\n \n \tif (!repo_config_get_expiry(the_repository, \"gc.pruneexpire\", &owned)) {\n \t\tfree(cfg->prune_expire);\n@@ -212,10 +212,10 @@ static void gc_config(struct gc_config *cfg)\n \t\tcfg->gc_log_expire = owned;\n \t}\n \n-\tgit_config_get_ulong(\"gc.bigpackthreshold\", &cfg->big_pack_threshold);\n-\tgit_config_get_ulong(\"pack.deltacachesize\", &cfg->max_delta_cache_size);\n+\trepo_config_get_ulong(the_repository, \"gc.bigpackthreshold\", &cfg->big_pack_threshold);\n+\trepo_config_get_ulong(the_repository, \"pack.deltacachesize\", &cfg->max_delta_cache_size);\n \n-\tif (!git_config_get_ulong(\"core.deltabasecachelimit\", &ulongval))\n+\tif (!repo_config_get_ulong(the_repository, \"core.deltabasecachelimit\", &ulongval))\n \t\tcfg->delta_base_cache_limit = ulongval;\n \n \tif (!repo_config_get_string(the_repository, \"gc.repackfilter\", &owned)) {\n@@ -2344,7 +2344,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit\n \t\tdie(_(\"failed to create directories for '%s'\"), filename);\n \n \tif ((long)lock_file_timeout_ms < 0 &&\n-\t    git_config_get_ulong(\"gc.launchctlplistlocktimeoutms\",\n+\t    repo_config_get_ulong(the_repository, \"gc.launchctlplistlocktimeoutms\",\n \t\t\t\t &lock_file_timeout_ms))\n \t\tlock_file_timeout_ms = 150;\n \ndiff --git a/config.h b/config.h\nindex 2490c47daaf..e22c07a4488 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_ulong(const char *key, unsigned long *dest)\n-{\n-\treturn repo_config_get_ulong(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_bool(const char *key, int *dest)\n {\n \treturn repo_config_get_bool(the_repository, key, dest);\ndiff --git a/http-backend.c b/http-backend.c\nindex ad8c4037493..3d5d5a84646 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -247,7 +247,7 @@ static void http_config(void)\n \tstruct strbuf var = STRBUF_INIT;\n \n \tgit_config_get_bool(\"http.getanyfile\", &getanyfile);\n-\tgit_config_get_ulong(\"http.maxrequestbuffer\", &max_request_buffer);\n+\trepo_config_get_ulong(the_repository, \"http.maxrequestbuffer\", &max_request_buffer);\n \n \tfor (i = 0; i < ARRAY_SIZE(rpc_service); i++) {\n \t\tstruct rpc_service *svc = &rpc_service[i];\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522558","messageId":"20250723-pks-config-wo-the-repository-v2-11-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 11/21] config: drop `git_config_get_bool()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:32Z","receivedAt":"2025-07-23T14:09:05Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_get_bool()`. All\ncallsites are adjusted so that they use\n`repo_config_get_bool(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n archive.c                          | 2 +-\n builtin/am.c                       | 8 ++++----\n builtin/checkout.c                 | 2 +-\n builtin/clone.c                    | 2 +-\n builtin/credential-cache--daemon.c | 2 +-\n builtin/gc.c                       | 6 +++---\n builtin/grep.c                     | 2 +-\n builtin/rebase.c                   | 2 +-\n compat/precompose_utf8.c           | 2 +-\n config.h                           | 5 -----\n daemon.c                           | 2 +-\n fetch-pack.c                       | 8 ++++----\n http-backend.c                     | 4 ++--\n merge-ort.c                        | 2 +-\n promisor-remote.c                  | 4 ++--\n read-cache.c                       | 4 ++--\n rerere.c                           | 4 ++--\n run-command.c                      | 6 +++---\n setup.c                            | 2 +-\n t/helper/test-config.c             | 2 +-\n transport.c                        | 2 +-\n 21 files changed, 34 insertions(+), 39 deletions(-)\n\ndiff --git a/archive.c b/archive.c\nindex 2dd306a07a7..310672b479a 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -760,7 +760,7 @@ int write_archive(int argc, const char **argv, const char *prefix,\n \tconst char **argv_copy;\n \tint rc;\n \n-\tgit_config_get_bool(\"uploadarchive.allowunreachable\", &remote_allow_unreachable);\n+\trepo_config_get_bool(the_repository, \"uploadarchive.allowunreachable\", &remote_allow_unreachable);\n \trepo_config(the_repository, git_default_config, NULL);\n \n \tdescribe_status.max_invocations = 1;\ndiff --git a/builtin/am.c b/builtin/am.c\nindex a7e7cf1465a..6073d64ae97 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -162,18 +162,18 @@ static void am_state_init(struct am_state *state)\n \n \tstate->prec = 4;\n \n-\tgit_config_get_bool(\"am.threeway\", &state->threeway);\n+\trepo_config_get_bool(the_repository, \"am.threeway\", &state->threeway);\n \n \tstate->utf8 = 1;\n \n-\tgit_config_get_bool(\"am.messageid\", &state->message_id);\n+\trepo_config_get_bool(the_repository, \"am.messageid\", &state->message_id);\n \n \tstate->scissors = SCISSORS_UNSET;\n \tstate->quoted_cr = quoted_cr_unset;\n \n \tstrvec_init(&state->git_apply_opts);\n \n-\tif (!git_config_get_bool(\"commit.gpgsign\", &gpgsign))\n+\tif (!repo_config_get_bool(the_repository, \"commit.gpgsign\", &gpgsign))\n \t\tstate->sign_commit = gpgsign ? \"\" : NULL;\n }\n \n@@ -965,7 +965,7 @@ static int split_mail(struct am_state *state, enum patch_format patch_format,\n {\n \tif (keep_cr < 0) {\n \t\tkeep_cr = 0;\n-\t\tgit_config_get_bool(\"am.keepcr\", &keep_cr);\n+\t\trepo_config_get_bool(the_repository, \"am.keepcr\", &keep_cr);\n \t}\n \n \tswitch (patch_format) {\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 948ff7bdda7..37efde59898 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -291,7 +291,7 @@ static int checkout_merged(int pos, const struct checkout *state,\n \tread_mmblob(&ours, &threeway[1]);\n \tread_mmblob(&theirs, &threeway[2]);\n \n-\tgit_config_get_bool(\"merge.renormalize\", &renormalize);\n+\trepo_config_get_bool(the_repository, \"merge.renormalize\", &renormalize);\n \tll_opts.renormalize = renormalize;\n \tll_opts.conflict_style = conflict_style;\n \tmerge_status = ll_merge(&result_buf, path, &ancestor, \"base\",\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 3c6d8529b6c..34eea11db4d 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -1150,7 +1150,7 @@ int cmd_clone(int argc,\n \t\t\tstrbuf_reset(&sb);\n \t\t}\n \n-\t\tif (!git_config_get_bool(\"submodule.stickyRecursiveClone\", &val) &&\n+\t\tif (!repo_config_get_bool(the_repository, \"submodule.stickyRecursiveClone\", &val) &&\n \t\t    val)\n \t\t\tstring_list_append(&option_config, \"submodule.recurse=true\");\n \ndiff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c\nindex 5065ff4660b..65cc619bec2 100644\n--- a/builtin/credential-cache--daemon.c\n+++ b/builtin/credential-cache--daemon.c\n@@ -307,7 +307,7 @@ int cmd_credential_cache_daemon(int argc,\n \t\tOPT_END()\n \t};\n \n-\tgit_config_get_bool(\"credentialcache.ignoresighup\", &ignore_sighup);\n+\trepo_config_get_bool(the_repository, \"credentialcache.ignoresighup\", &ignore_sighup);\n \n \targc = parse_options(argc, argv, prefix, options, usage, 0);\n \tsocket_path = argv[0];\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex d15daf59625..fa62e4f2627 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -193,8 +193,8 @@ static void gc_config(struct gc_config *cfg)\n \trepo_config_get_int(the_repository, \"gc.aggressivedepth\", &cfg->aggressive_depth);\n \trepo_config_get_int(the_repository, \"gc.auto\", &cfg->gc_auto_threshold);\n \trepo_config_get_int(the_repository, \"gc.autopacklimit\", &cfg->gc_auto_pack_limit);\n-\tgit_config_get_bool(\"gc.autodetach\", &cfg->detach_auto);\n-\tgit_config_get_bool(\"gc.cruftpacks\", &cfg->cruft_packs);\n+\trepo_config_get_bool(the_repository, \"gc.autodetach\", &cfg->detach_auto);\n+\trepo_config_get_bool(the_repository, \"gc.cruftpacks\", &cfg->cruft_packs);\n \trepo_config_get_ulong(the_repository, \"gc.maxcruftsize\", &cfg->max_cruft_size);\n \n \tif (!repo_config_get_expiry(the_repository, \"gc.pruneexpire\", &owned)) {\n@@ -1779,7 +1779,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,\n \t\tstrbuf_reset(&config_name);\n \t\tstrbuf_addf(&config_name, \"maintenance.%s.enabled\",\n \t\t\t    tasks[i].name);\n-\t\tif (!git_config_get_bool(config_name.buf, &config_value))\n+\t\tif (!repo_config_get_bool(the_repository, config_name.buf, &config_value))\n \t\t\tstrategy.tasks[i].enabled = config_value;\n \t\tif (!strategy.tasks[i].enabled)\n \t\t\tcontinue;\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 7982dda9a3b..8fcb69dbf2c 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -1058,7 +1058,7 @@ int cmd_grep(int argc,\n \n \tif (use_index && !startup_info->have_repository) {\n \t\tint fallback = 0;\n-\t\tgit_config_get_bool(\"grep.fallbacktonoindex\", &fallback);\n+\t\trepo_config_get_bool(the_repository, \"grep.fallbacktonoindex\", &fallback);\n \t\tif (fallback)\n \t\t\tuse_index = 0;\n \t\telse\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 0c3daa4b814..72a52bdfb98 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -340,7 +340,7 @@ static int run_sequencer_rebase(struct rebase_options *opts)\n \tunsigned flags = 0;\n \tint abbreviate_commands = 0, ret = 0;\n \n-\tgit_config_get_bool(\"rebase.abbreviatecommands\", &abbreviate_commands);\n+\trepo_config_get_bool(the_repository, \"rebase.abbreviatecommands\", &abbreviate_commands);\n \n \tflags |= opts->keep_empty ? TODO_LIST_KEEP_EMPTY : 0;\n \tflags |= abbreviate_commands ? TODO_LIST_ABBREVIATE_CMDS : 0;\ndiff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c\nindex 12e38e0ea3c..3985ed108eb 100644\n--- a/compat/precompose_utf8.c\n+++ b/compat/precompose_utf8.c\n@@ -75,7 +75,7 @@ const char *precompose_string_if_needed(const char *in)\n \t\ticonv_t ic_prec;\n \t\tchar *out;\n \t\tif (precomposed_unicode < 0)\n-\t\t\tgit_config_get_bool(\"core.precomposeunicode\", &precomposed_unicode);\n+\t\t\trepo_config_get_bool(the_repository, \"core.precomposeunicode\", &precomposed_unicode);\n \t\tif (precomposed_unicode != 1)\n \t\t\treturn in;\n \t\tic_prec = iconv_open(repo_encoding, path_encoding);\ndiff --git a/config.h b/config.h\nindex e22c07a4488..c9f582c7c55 100644\n--- a/config.h\n+++ b/config.h\n@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n # ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_bool(const char *key, int *dest)\n-{\n-\treturn repo_config_get_bool(the_repository, key, dest);\n-}\n-\n static inline int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest)\n {\n \treturn repo_config_get_bool_or_int(the_repository, key, is_bool, dest);\ndiff --git a/daemon.c b/daemon.c\nindex 61cd50f7200..cb209235557 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -402,7 +402,7 @@ static int run_service(const char *dir, struct daemon_service *service,\n \n \tif (service->overridable) {\n \t\tstrbuf_addf(&var, \"daemon.%s\", service->config_name);\n-\t\tgit_config_get_bool(var.buf, &enabled);\n+\t\trepo_config_get_bool(the_repository, var.buf, &enabled);\n \t\tstrbuf_release(&var);\n \t}\n \tif (!enabled) {\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 1f184efb3c9..94b1436c5c2 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1903,10 +1903,10 @@ static void fetch_pack_config(void)\n {\n \trepo_config_get_int(the_repository, \"fetch.unpacklimit\", &fetch_unpack_limit);\n \trepo_config_get_int(the_repository, \"transfer.unpacklimit\", &transfer_unpack_limit);\n-\tgit_config_get_bool(\"repack.usedeltabaseoffset\", &prefer_ofs_delta);\n-\tgit_config_get_bool(\"fetch.fsckobjects\", &fetch_fsck_objects);\n-\tgit_config_get_bool(\"transfer.fsckobjects\", &transfer_fsck_objects);\n-\tgit_config_get_bool(\"transfer.advertisesid\", &advertise_sid);\n+\trepo_config_get_bool(the_repository, \"repack.usedeltabaseoffset\", &prefer_ofs_delta);\n+\trepo_config_get_bool(the_repository, \"fetch.fsckobjects\", &fetch_fsck_objects);\n+\trepo_config_get_bool(the_repository, \"transfer.fsckobjects\", &transfer_fsck_objects);\n+\trepo_config_get_bool(the_repository, \"transfer.advertisesid\", &advertise_sid);\n \tif (!uri_protocols.nr) {\n \t\tchar *str;\n \ndiff --git a/http-backend.c b/http-backend.c\nindex 3d5d5a84646..d5dfe762bb5 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -246,13 +246,13 @@ static void http_config(void)\n \tint i, value = 0;\n \tstruct strbuf var = STRBUF_INIT;\n \n-\tgit_config_get_bool(\"http.getanyfile\", &getanyfile);\n+\trepo_config_get_bool(the_repository, \"http.getanyfile\", &getanyfile);\n \trepo_config_get_ulong(the_repository, \"http.maxrequestbuffer\", &max_request_buffer);\n \n \tfor (i = 0; i < ARRAY_SIZE(rpc_service); i++) {\n \t\tstruct rpc_service *svc = &rpc_service[i];\n \t\tstrbuf_addf(&var, \"http.%s\", svc->config_name);\n-\t\tif (!git_config_get_bool(var.buf, &value))\n+\t\tif (!repo_config_get_bool(the_repository, var.buf, &value))\n \t\t\tsvc->enabled = value;\n \t\tstrbuf_reset(&var);\n \t}\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 45fd41f8dfd..86896ff11b0 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -5356,7 +5356,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)\n \trepo_config_get_int(the_repository, \"merge.verbosity\", &opt->verbosity);\n \trepo_config_get_int(the_repository, \"diff.renamelimit\", &opt->rename_limit);\n \trepo_config_get_int(the_repository, \"merge.renamelimit\", &opt->rename_limit);\n-\tgit_config_get_bool(\"merge.renormalize\", &renormalize);\n+\trepo_config_get_bool(the_repository, \"merge.renormalize\", &renormalize);\n \topt->renormalize = renormalize;\n \tif (!repo_config_get_string(the_repository, \"diff.renames\", &value)) {\n \t\topt->detect_renames = git_config_rename(\"diff.renames\", value);\ndiff --git a/promisor-remote.c b/promisor-remote.c\nindex a9c877d9cfa..08b0da89622 100644\n--- a/promisor-remote.c\n+++ b/promisor-remote.c\n@@ -46,7 +46,7 @@ static int fetch_objects(struct repository *repo,\n \t\t     \"fetch\", remote_name, \"--no-tags\",\n \t\t     \"--no-write-fetch-head\", \"--recurse-submodules=no\",\n \t\t     \"--filter=blob:none\", \"--stdin\", NULL);\n-\tif (!git_config_get_bool(\"promisor.quiet\", &quiet) && quiet)\n+\tif (!repo_config_get_bool(the_repository, \"promisor.quiet\", &quiet) && quiet)\n \t\tstrvec_push(&child.args, \"--quiet\");\n \tif (start_command(&child))\n \t\tdie(_(\"promisor-remote: unable to fork off fetch subprocess\"));\n@@ -343,7 +343,7 @@ char *promisor_remote_info(struct repository *repo)\n \tstruct strvec names = STRVEC_INIT;\n \tstruct strvec urls = STRVEC_INIT;\n \n-\tgit_config_get_bool(\"promisor.advertise\", &advertise_promisors);\n+\trepo_config_get_bool(the_repository, \"promisor.advertise\", &advertise_promisors);\n \n \tif (!advertise_promisors)\n \t\treturn NULL;\ndiff --git a/read-cache.c b/read-cache.c\nindex 5cf41b81f1f..4fdde758d1b 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -2755,7 +2755,7 @@ static int record_eoie(void)\n {\n \tint val;\n \n-\tif (!git_config_get_bool(\"index.recordendofindexentries\", &val))\n+\tif (!repo_config_get_bool(the_repository, \"index.recordendofindexentries\", &val))\n \t\treturn val;\n \n \t/*\n@@ -2770,7 +2770,7 @@ static int record_ieot(void)\n {\n \tint val;\n \n-\tif (!git_config_get_bool(\"index.recordoffsettable\", &val))\n+\tif (!repo_config_get_bool(the_repository, \"index.recordoffsettable\", &val))\n \t\treturn val;\n \n \t/*\ndiff --git a/rerere.c b/rerere.c\nindex 1ac2075144c..c7c3e535ce5 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -877,8 +877,8 @@ static int do_plain_rerere(struct repository *r,\n \n static void git_rerere_config(void)\n {\n-\tgit_config_get_bool(\"rerere.enabled\", &rerere_enabled);\n-\tgit_config_get_bool(\"rerere.autoupdate\", &rerere_autoupdate);\n+\trepo_config_get_bool(the_repository, \"rerere.enabled\", &rerere_enabled);\n+\trepo_config_get_bool(the_repository, \"rerere.autoupdate\", &rerere_autoupdate);\n \trepo_config(the_repository, git_default_config, NULL);\n }\n \ndiff --git a/run-command.c b/run-command.c\nindex 8833b233678..ed9575bd6a8 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -1817,7 +1817,7 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint)\n {\n \tint enabled, auto_detach;\n \n-\tif (!git_config_get_bool(\"maintenance.auto\", &enabled) &&\n+\tif (!repo_config_get_bool(the_repository, \"maintenance.auto\", &enabled) &&\n \t    !enabled)\n \t\treturn 0;\n \n@@ -1826,8 +1826,8 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint)\n \t * honoring `gc.autoDetach`. This is somewhat weird, but required to\n \t * retain behaviour from when we used to run git-gc(1) here.\n \t */\n-\tif (git_config_get_bool(\"maintenance.autodetach\", &auto_detach) &&\n-\t    git_config_get_bool(\"gc.autodetach\", &auto_detach))\n+\tif (repo_config_get_bool(the_repository, \"maintenance.autodetach\", &auto_detach) &&\n+\t    repo_config_get_bool(the_repository, \"gc.autodetach\", &auto_detach))\n \t\tauto_detach = 1;\n \n \tmaint->git_cmd = 1;\ndiff --git a/setup.c b/setup.c\nindex 9661c5d5d5d..a06bb921b3a 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1877,7 +1877,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t * the core.precomposeunicode configuration, this\n \t * has to happen after the above block that finds\n \t * out where the repository is, i.e. a preparation\n-\t * for calling git_config_get_bool().\n+\t * for calling repo_config_get_bool().\n \t */\n \tif (prefix) {\n \t\tprefix = precompose_string_if_needed(prefix);\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex ce1e3330516..9f8cca7c48c 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -163,7 +163,7 @@ int cmd__config(int argc, const char **argv)\n \t\t\tgoto exit1;\n \t\t}\n \t} else if (argc == 3 && !strcmp(argv[1], \"get_bool\")) {\n-\t\tif (!git_config_get_bool(argv[2], &val)) {\n+\t\tif (!repo_config_get_bool(the_repository, argv[2], &val)) {\n \t\t\tprintf(\"%d\\n\", val);\n \t\t\tgoto exit0;\n \t\t} else {\ndiff --git a/transport.c b/transport.c\nindex 89e6297ce22..e305d6bd228 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -1602,7 +1602,7 @@ int transport_get_remote_bundle_uri(struct transport *transport)\n \t * Don't request bundle-uri from the server unless configured to\n \t * do so by the transfer.bundleURI=true config option.\n \t */\n-\tif (git_config_get_bool(\"transfer.bundleuri\", &value) || !value)\n+\tif (repo_config_get_bool(the_repository, \"transfer.bundleuri\", &value) || !value)\n \t\treturn 0;\n \n \tif (!transport->bundles->baseURI)\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522559","messageId":"20250723-pks-config-wo-the-repository-v2-12-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 12/21] config: drop `git_config_set_in_file()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:33Z","receivedAt":"2025-07-23T14:09:09Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_set_in_file()`.\nAll callsites are adjusted so that they use\n`repo_config_set_in_file(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/submodule--helper.c | 10 +++++-----\n config.h                    |  6 ------\n dir.c                       |  4 ++--\n 3 files changed, 7 insertions(+), 13 deletions(-)\n\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex d2ab31835b5..0be737ac4ff 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1810,12 +1810,12 @@ static int clone_submodule(const struct module_clone_data *clone_data,\n \t/* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */\n \trepo_config_get_string(the_repository, \"submodule.alternateLocation\", &sm_alternate);\n \tif (sm_alternate)\n-\t\tgit_config_set_in_file(p, \"submodule.alternateLocation\",\n-\t\t\t\t       sm_alternate);\n+\t\trepo_config_set_in_file(the_repository, p, \"submodule.alternateLocation\",\n+\t\t\t\t\tsm_alternate);\n \trepo_config_get_string(the_repository, \"submodule.alternateErrorStrategy\", &error_strategy);\n \tif (error_strategy)\n-\t\tgit_config_set_in_file(p, \"submodule.alternateErrorStrategy\",\n-\t\t\t\t       error_strategy);\n+\t\trepo_config_set_in_file(the_repository, p, \"submodule.alternateErrorStrategy\",\n+\t\t\t\t\terror_strategy);\n \n \tfree(sm_alternate);\n \tfree(error_strategy);\n@@ -2522,7 +2522,7 @@ static int ensure_core_worktree(const char *path)\n \t\tabs_path = absolute_pathdup(path);\n \t\trel_path = relative_path(abs_path, subrepo.gitdir, &sb);\n \n-\t\tgit_config_set_in_file(cfg_file, \"core.worktree\", rel_path);\n+\t\trepo_config_set_in_file(the_repository, cfg_file, \"core.worktree\", rel_path);\n \n \t\tfree(cfg_file);\n \t\tfree(abs_path);\ndiff --git a/config.h b/config.h\nindex c9f582c7c55..b4f79d4d4cc 100644\n--- a/config.h\n+++ b/config.h\n@@ -734,12 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)\n \treturn repo_config_get_pathname(the_repository, key, dest);\n }\n \n-static inline void git_config_set_in_file(const char *config_filename,\n-\t\t\t\t\t  const char *key, const char *value)\n-{\n-\trepo_config_set_in_file(the_repository, config_filename, key, value);\n-}\n-\n static inline int git_config_set_gently(const char *key, const char *value)\n {\n \treturn repo_config_set_gently(the_repository, key, value);\ndiff --git a/dir.c b/dir.c\nindex 02873f59ea6..dfb4d40103f 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -4091,8 +4091,8 @@ void connect_work_tree_and_git_dir(const char *work_tree_,\n \twrite_file(gitfile_sb.buf, \"gitdir: %s\",\n \t\t   relative_path(git_dir, work_tree, &rel_path));\n \t/* Update core.worktree setting */\n-\tgit_config_set_in_file(cfg_sb.buf, \"core.worktree\",\n-\t\t\t       relative_path(work_tree, git_dir, &rel_path));\n+\trepo_config_set_in_file(the_repository, cfg_sb.buf, \"core.worktree\",\n+\t\t\t\trelative_path(work_tree, git_dir, &rel_path));\n \n \tstrbuf_release(&gitfile_sb);\n \tstrbuf_release(&cfg_sb);\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522560","messageId":"20250723-pks-config-wo-the-repository-v2-13-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 13/21] config: drop `git_config_set_gently()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:34Z","receivedAt":"2025-07-23T14:09:11Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_set_gently()`.\nAll callsites are adjusted so that they use\n`repo_config_set_gently(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n branch.c                    |  6 +++---\n builtin/clone.c             |  2 +-\n builtin/remote.c            |  8 ++++----\n builtin/submodule--helper.c | 14 +++++++-------\n config.h                    |  5 -----\n scalar.c                    |  4 ++--\n setup.c                     |  4 ++--\n worktree.c                  |  4 ++--\n 8 files changed, 21 insertions(+), 26 deletions(-)\n\ndiff --git a/branch.c b/branch.c\nindex b4811671fc7..3dc237adf6c 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -116,7 +116,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,\n \t\t\t}\n \n \tstrbuf_addf(&key, \"branch.%s.remote\", local);\n-\tif (git_config_set_gently(key.buf, origin ? origin : \".\") < 0)\n+\tif (repo_config_set_gently(the_repository, key.buf, origin ? origin : \".\") < 0)\n \t\tgoto out_err;\n \n \tstrbuf_reset(&key);\n@@ -127,7 +127,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,\n \t * more than one is provided, use CONFIG_REGEX_NONE to preserve what\n \t * we've written so far.\n \t */\n-\tif (git_config_set_gently(key.buf, NULL) < 0)\n+\tif (repo_config_set_gently(the_repository, key.buf, NULL) < 0)\n \t\tgoto out_err;\n \tfor_each_string_list_item(item, remotes)\n \t\tif (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)\n@@ -136,7 +136,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,\n \tif (rebasing) {\n \t\tstrbuf_reset(&key);\n \t\tstrbuf_addf(&key, \"branch.%s.rebase\", local);\n-\t\tif (git_config_set_gently(key.buf, \"true\") < 0)\n+\t\tif (repo_config_set_gently(the_repository, key.buf, \"true\") < 0)\n \t\t\tgoto out_err;\n \t}\n \tstrbuf_release(&key);\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 34eea11db4d..0d7dd5e8ec9 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -1467,7 +1467,7 @@ int cmd_clone(int argc,\n \t\t\twarning(_(\"failed to fetch objects from bundle URI '%s'\"),\n \t\t\t\tbundle_uri);\n \t\telse if (has_heuristic)\n-\t\t\tgit_config_set_gently(\"fetch.bundleuri\", bundle_uri);\n+\t\t\trepo_config_set_gently(the_repository, \"fetch.bundleuri\", bundle_uri);\n \n \t\tremote_state_clear(the_repository->remote_state);\n \t\tfree(the_repository->remote_state);\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 826b2dcfd04..5c4dfc98afa 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -694,8 +694,8 @@ static void handle_push_default(const char* old_name, const char* new_name)\n \tif (push_default.scope >= CONFIG_SCOPE_COMMAND)\n \t\t; /* pass */\n \telse if (push_default.scope >= CONFIG_SCOPE_LOCAL) {\n-\t\tint result = git_config_set_gently(\"remote.pushDefault\",\n-\t\t\t\t\t\t   new_name);\n+\t\tint result = repo_config_set_gently(the_repository, \"remote.pushDefault\",\n+\t\t\t\t\t\t    new_name);\n \t\tif (new_name && result && result != CONFIG_NOTHING_SET)\n \t\t\tdie(_(\"could not set '%s'\"), \"remote.pushDefault\");\n \t\telse if (!new_name && result && result != CONFIG_NOTHING_SET)\n@@ -934,7 +934,7 @@ static int rm(int argc, const char **argv, const char *prefix,\n \t\t\t\tstrbuf_reset(&buf);\n \t\t\t\tstrbuf_addf(&buf, \"branch.%s.%s\",\n \t\t\t\t\t\titem->string, *k);\n-\t\t\t\tresult = git_config_set_gently(buf.buf, NULL);\n+\t\t\t\tresult = repo_config_set_gently(the_repository, buf.buf, NULL);\n \t\t\t\tif (result && result != CONFIG_NOTHING_SET)\n \t\t\t\t\tdie(_(\"could not unset '%s'\"), buf.buf);\n \t\t\t}\n@@ -942,7 +942,7 @@ static int rm(int argc, const char **argv, const char *prefix,\n \t\tif (info->push_remote_name && !strcmp(info->push_remote_name, remote->name)) {\n \t\t\tstrbuf_reset(&buf);\n \t\t\tstrbuf_addf(&buf, \"branch.%s.pushremote\", item->string);\n-\t\t\tresult = git_config_set_gently(buf.buf, NULL);\n+\t\t\tresult = repo_config_set_gently(the_repository, buf.buf, NULL);\n \t\t\tif (result && result != CONFIG_NOTHING_SET)\n \t\t\t\tdie(_(\"could not unset '%s'\"), buf.buf);\n \t\t}\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 0be737ac4ff..710a2a2004e 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -458,7 +458,7 @@ static void init_submodule(const char *path, const char *prefix,\n \t */\n \tif (!is_submodule_active(the_repository, path)) {\n \t\tstrbuf_addf(&sb, \"submodule.%s.active\", sub->name);\n-\t\tgit_config_set_gently(sb.buf, \"true\");\n+\t\trepo_config_set_gently(the_repository, sb.buf, \"true\");\n \t\tstrbuf_reset(&sb);\n \t}\n \n@@ -484,7 +484,7 @@ static void init_submodule(const char *path, const char *prefix,\n \t\t\tfree(oldurl);\n \t\t}\n \n-\t\tif (git_config_set_gently(sb.buf, url))\n+\t\tif (repo_config_set_gently(the_repository, sb.buf, url))\n \t\t\tdie(_(\"Failed to register url for submodule path '%s'\"),\n \t\t\t    displaypath);\n \t\tif (!(flags & OPT_QUIET))\n@@ -506,7 +506,7 @@ static void init_submodule(const char *path, const char *prefix,\n \t\t\tupd = submodule_update_type_to_string(sub->update_strategy.type);\n \t\t}\n \n-\t\tif (git_config_set_gently(sb.buf, upd))\n+\t\tif (repo_config_set_gently(the_repository, sb.buf, upd))\n \t\t\tdie(_(\"Failed to register update mode for submodule path '%s'\"), displaypath);\n \t}\n \tstrbuf_release(&sb);\n@@ -1262,7 +1262,7 @@ static void sync_submodule(const char *path, const char *prefix,\n \n \tstrbuf_reset(&sb);\n \tstrbuf_addf(&sb, \"submodule.%s.url\", sub->name);\n-\tif (git_config_set_gently(sb.buf, super_config_url))\n+\tif (repo_config_set_gently(the_repository, sb.buf, super_config_url))\n \t\tdie(_(\"failed to register url for submodule path '%s'\"),\n \t\t      displaypath);\n \n@@ -3309,7 +3309,7 @@ static void configure_added_submodule(struct add_data *add_data)\n \tstruct child_process add_gitmodules = CHILD_PROCESS_INIT;\n \n \tkey = xstrfmt(\"submodule.%s.url\", add_data->sm_name);\n-\tgit_config_set_gently(key, add_data->realrepo);\n+\trepo_config_set_gently(the_repository, key, add_data->realrepo);\n \tfree(key);\n \n \tadd_submod.git_cmd = 1;\n@@ -3356,12 +3356,12 @@ static void configure_added_submodule(struct add_data *add_data)\n \t\t */\n \t\tif (!is_submodule_active(the_repository, add_data->sm_path)) {\n \t\t\tkey = xstrfmt(\"submodule.%s.active\", add_data->sm_name);\n-\t\t\tgit_config_set_gently(key, \"true\");\n+\t\t\trepo_config_set_gently(the_repository, key, \"true\");\n \t\t\tfree(key);\n \t\t}\n \t} else {\n \t\tkey = xstrfmt(\"submodule.%s.active\", add_data->sm_name);\n-\t\tgit_config_set_gently(key, \"true\");\n+\t\trepo_config_set_gently(the_repository, key, \"true\");\n \t\tfree(key);\n \t}\n }\ndiff --git a/config.h b/config.h\nindex b4f79d4d4cc..90977441c3b 100644\n--- a/config.h\n+++ b/config.h\n@@ -734,11 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)\n \treturn repo_config_get_pathname(the_repository, key, dest);\n }\n \n-static inline int git_config_set_gently(const char *key, const char *value)\n-{\n-\treturn repo_config_set_gently(the_repository, key, value);\n-}\n-\n static inline void git_config_set(const char *key, const char *value)\n {\n \trepo_config_set(the_repository, key, value);\ndiff --git a/scalar.c b/scalar.c\nindex 07f855c9913..c09c5ca194e 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -103,7 +103,7 @@ static int set_scalar_config(const struct scalar_config *config, int reconfigure\n \tif ((reconfigure && config->overwrite_on_reconfigure) ||\n \t    repo_config_get_string(the_repository, config->key, &value)) {\n \t\ttrace2_data_string(\"scalar\", the_repository, config->key, \"created\");\n-\t\tres = git_config_set_gently(config->key, config->value);\n+\t\tres = repo_config_set_gently(the_repository, config->key, config->value);\n \t} else {\n \t\ttrace2_data_string(\"scalar\", the_repository, config->key, \"exists\");\n \t\tres = 0;\n@@ -322,7 +322,7 @@ static int set_config(const char *fmt, ...)\n \tvalue = strchr(buf.buf, '=');\n \tif (value)\n \t\t*(value++) = '\\0';\n-\tres = git_config_set_gently(buf.buf, value);\n+\tres = repo_config_set_gently(the_repository, buf.buf, value);\n \tstrbuf_release(&buf);\n \n \treturn res;\ndiff --git a/setup.c b/setup.c\nindex a06bb921b3a..a05c348dcdf 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -2236,13 +2236,13 @@ void initialize_repository_version(int hash_algo,\n \t\tgit_config_set(\"extensions.objectformat\",\n \t\t\t       hash_algos[hash_algo].name);\n \telse if (reinit)\n-\t\tgit_config_set_gently(\"extensions.objectformat\", NULL);\n+\t\trepo_config_set_gently(the_repository, \"extensions.objectformat\", NULL);\n \n \tif (ref_storage_format != REF_STORAGE_FORMAT_FILES)\n \t\tgit_config_set(\"extensions.refstorage\",\n \t\t\t       ref_storage_format_to_name(ref_storage_format));\n \telse if (reinit)\n-\t\tgit_config_set_gently(\"extensions.refstorage\", NULL);\n+\t\trepo_config_set_gently(the_repository, \"extensions.refstorage\", NULL);\n \n \tif (reinit) {\n \t\tstruct strbuf config = STRBUF_INIT;\ndiff --git a/worktree.c b/worktree.c\nindex c34b9eb74e5..981a2713374 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -1013,7 +1013,7 @@ int init_worktree_config(struct repository *r)\n \t */\n \tif (r->repository_format_worktree_config)\n \t\treturn 0;\n-\tif ((res = git_config_set_gently(\"extensions.worktreeConfig\", \"true\")))\n+\tif ((res = repo_config_set_gently(the_repository, \"extensions.worktreeConfig\", \"true\")))\n \t\treturn error(_(\"failed to set extensions.worktreeConfig setting\"));\n \n \tcommon_config_file = xstrfmt(\"%s/config\", r->commondir);\n@@ -1077,7 +1077,7 @@ void write_worktree_linking_files(struct strbuf dotgit, struct strbuf gitdir,\n \tif (use_relative_paths && !the_repository->repository_format_relative_worktrees) {\n \t\tif (upgrade_repository_format(1) < 0)\n \t\t\tdie(_(\"unable to upgrade repository format to support relative worktrees\"));\n-\t\tif (git_config_set_gently(\"extensions.relativeWorktrees\", \"true\"))\n+\t\tif (repo_config_set_gently(the_repository, \"extensions.relativeWorktrees\", \"true\"))\n \t\t\tdie(_(\"unable to set extensions.relativeWorktrees setting\"));\n \t\tthe_repository->repository_format_relative_worktrees = 1;\n \t}\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522561","messageId":"20250723-pks-config-wo-the-repository-v2-14-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 14/21] config: drop `git_config_set()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:35Z","receivedAt":"2025-07-23T14:09:14Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_set()`. All\ncallsites are adjusted so that they use `repo_config_set(the_repository,\n...)` instead. While some callsites might already have a repository\navailable, this mechanical conversion is the exact same as the current\nsituation and thus cannot cause any regression. Those sites should\neventually be cleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/branch.c              |  2 +-\n builtin/clone.c               |  8 ++++----\n builtin/gc.c                  |  4 ++--\n builtin/remote.c              | 16 ++++++++--------\n compat/precompose_utf8.c      |  4 ++--\n config.c                      |  2 +-\n config.h                      |  5 -----\n list-objects-filter-options.c |  6 +++---\n setup.c                       | 30 +++++++++++++++---------------\n 9 files changed, 36 insertions(+), 41 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 08e50bf77b3..5de0691d18d 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -699,7 +699,7 @@ static int edit_branch_description(const char *branch_name)\n \n \tstrbuf_addf(&name, \"branch.%s.description\", branch_name);\n \tif (buf.len || exists)\n-\t\tgit_config_set(name.buf, buf.len ? buf.buf : NULL);\n+\t\trepo_config_set(the_repository, name.buf, buf.len ? buf.buf : NULL);\n \tstrbuf_release(&name);\n \tstrbuf_release(&buf);\n \ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 0d7dd5e8ec9..f025a8f19e0 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -827,7 +827,7 @@ static void write_refspec_config(const char *src_ref_prefix,\n \n \t\t\tif (option_mirror) {\n \t\t\t\tstrbuf_addf(&key, \"remote.%s.mirror\", remote_name);\n-\t\t\t\tgit_config_set(key.buf, \"true\");\n+\t\t\t\trepo_config_set(the_repository, key.buf, \"true\");\n \t\t\t\tstrbuf_reset(&key);\n \t\t\t}\n \t\t}\n@@ -1294,18 +1294,18 @@ int cmd_clone(int argc,\n \t\t\tsrc_ref_prefix = \"refs/\";\n \t\tstrbuf_addstr(&branch_top, src_ref_prefix);\n \n-\t\tgit_config_set(\"core.bare\", \"true\");\n+\t\trepo_config_set(the_repository, \"core.bare\", \"true\");\n \t} else if (!option_rev) {\n \t\tstrbuf_addf(&branch_top, \"refs/remotes/%s/\", remote_name);\n \t}\n \n \tstrbuf_addf(&key, \"remote.%s.url\", remote_name);\n-\tgit_config_set(key.buf, repo);\n+\trepo_config_set(the_repository, key.buf, repo);\n \tstrbuf_reset(&key);\n \n \tif (!option_tags) {\n \t\tstrbuf_addf(&key, \"remote.%s.tagOpt\", remote_name);\n-\t\tgit_config_set(key.buf, \"--no-tags\");\n+\t\trepo_config_set(the_repository, key.buf, \"--no-tags\");\n \t\tstrbuf_reset(&key);\n \t}\n \ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex fa62e4f2627..c0fe4e73087 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -1913,11 +1913,11 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,\n \t\t\t\t   options);\n \n \t/* Disable foreground maintenance */\n-\tgit_config_set(\"maintenance.auto\", \"false\");\n+\trepo_config_set(the_repository, \"maintenance.auto\", \"false\");\n \n \t/* Set maintenance strategy, if unset */\n \tif (repo_config_get(the_repository, \"maintenance.strategy\"))\n-\t\tgit_config_set(\"maintenance.strategy\", \"incremental\");\n+\t\trepo_config_set(the_repository, \"maintenance.strategy\", \"incremental\");\n \n \tif (!repo_config_get_string_multi(the_repository, key, &list)) {\n \t\tfor_each_string_list_item(item, list) {\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 5c4dfc98afa..827639e0398 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -209,7 +209,7 @@ static int add(int argc, const char **argv, const char *prefix,\n \t\tdie(_(\"'%s' is not a valid remote name\"), name);\n \n \tstrbuf_addf(&buf, \"remote.%s.url\", name);\n-\tgit_config_set(buf.buf, url);\n+\trepo_config_set(the_repository, buf.buf, url);\n \n \tif (!mirror || mirror & MIRROR_FETCH) {\n \t\tstrbuf_reset(&buf);\n@@ -225,14 +225,14 @@ static int add(int argc, const char **argv, const char *prefix,\n \tif (mirror & MIRROR_PUSH) {\n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addf(&buf, \"remote.%s.mirror\", name);\n-\t\tgit_config_set(buf.buf, \"true\");\n+\t\trepo_config_set(the_repository, buf.buf, \"true\");\n \t}\n \n \tif (fetch_tags != TAGS_DEFAULT) {\n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addf(&buf, \"remote.%s.tagOpt\", name);\n-\t\tgit_config_set(buf.buf,\n-\t\t\t       fetch_tags == TAGS_SET ? \"--tags\" : \"--no-tags\");\n+\t\trepo_config_set(the_repository, buf.buf,\n+\t\t\t\tfetch_tags == TAGS_SET ? \"--tags\" : \"--no-tags\");\n \t}\n \n \tif (fetch && fetch_remote(name)) {\n@@ -802,12 +802,12 @@ static int mv(int argc, const char **argv, const char *prefix,\n \t\tif (info->remote_name && !strcmp(info->remote_name, rename.old_name)) {\n \t\t\tstrbuf_reset(&buf);\n \t\t\tstrbuf_addf(&buf, \"branch.%s.remote\", item->string);\n-\t\t\tgit_config_set(buf.buf, rename.new_name);\n+\t\t\trepo_config_set(the_repository, buf.buf, rename.new_name);\n \t\t}\n \t\tif (info->push_remote_name && !strcmp(info->push_remote_name, rename.old_name)) {\n \t\t\tstrbuf_reset(&buf);\n \t\t\tstrbuf_addf(&buf, \"branch.%s.pushRemote\", item->string);\n-\t\t\tgit_config_set(buf.buf, rename.new_name);\n+\t\t\trepo_config_set(the_repository, buf.buf, rename.new_name);\n \t\t}\n \t}\n \n@@ -1503,7 +1503,7 @@ static int set_head(int argc, const char **argv, const char *prefix,\n \t\tstruct strbuf config_name = STRBUF_INIT;\n \t\tstrbuf_addf(&config_name,\n \t\t\t\"remote.%s.followremotehead\", remote->name);\n-\t\tgit_config_set(config_name.buf, \"warn\");\n+\t\trepo_config_set(the_repository, config_name.buf, \"warn\");\n \t\tstrbuf_release(&config_name);\n \t}\n \n@@ -1793,7 +1793,7 @@ static int set_url(int argc, const char **argv, const char *prefix,\n \t\t\tgit_config_set_multivar(name_buf.buf, newurl,\n \t\t\t\t\t\t       \"^$\", 0);\n \t\telse\n-\t\t\tgit_config_set(name_buf.buf, newurl);\n+\t\t\trepo_config_set(the_repository, name_buf.buf, newurl);\n \t\tgoto out;\n \t}\n \ndiff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c\nindex 3985ed108eb..43b3be01143 100644\n--- a/compat/precompose_utf8.c\n+++ b/compat/precompose_utf8.c\n@@ -56,8 +56,8 @@ void probe_utf8_pathname_composition(void)\n \t\tclose(output_fd);\n \t\trepo_git_path_replace(the_repository, &path, \"%s\", auml_nfd);\n \t\tprecomposed_unicode = access(path.buf, R_OK) ? 0 : 1;\n-\t\tgit_config_set(\"core.precomposeunicode\",\n-\t\t\t       precomposed_unicode ? \"true\" : \"false\");\n+\t\trepo_config_set(the_repository, \"core.precomposeunicode\",\n+\t\t\t\tprecomposed_unicode ? \"true\" : \"false\");\n \t\trepo_git_path_replace(the_repository, &path, \"%s\", auml_nfc);\n \t\tif (unlink(path.buf))\n \t\t\tdie_errno(_(\"failed to unlink '%s'\"), path.buf);\ndiff --git a/config.c b/config.c\nindex 095a17bd429..285cab0ce2a 100644\n--- a/config.c\n+++ b/config.c\n@@ -2748,7 +2748,7 @@ void git_die_config(struct repository *r, const char *key, const char *err, ...)\n }\n \n /*\n- * Find all the stuff for git_config_set() below.\n+ * Find all the stuff for repo_config_set() below.\n  */\n \n struct config_store_data {\ndiff --git a/config.h b/config.h\nindex 90977441c3b..43d06c279e3 100644\n--- a/config.h\n+++ b/config.h\n@@ -734,11 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)\n \treturn repo_config_get_pathname(the_repository, key, dest);\n }\n \n-static inline void git_config_set(const char *key, const char *value)\n-{\n-\trepo_config_set(the_repository, key, value);\n-}\n-\n static inline int git_config_set_in_file_gently(\n \tconst char *config_filename,\n \tconst char *key,\ndiff --git a/list-objects-filter-options.c b/list-objects-filter-options.c\nindex 948376d42d0..7420bf81fe0 100644\n--- a/list-objects-filter-options.c\n+++ b/list-objects-filter-options.c\n@@ -350,7 +350,7 @@ void partial_clone_register(\n \n \t\t/* Add promisor config for the remote */\n \t\tcfg_name = xstrfmt(\"remote.%s.promisor\", remote);\n-\t\tgit_config_set(cfg_name, \"true\");\n+\t\trepo_config_set(the_repository, cfg_name, \"true\");\n \t\tfree(cfg_name);\n \t}\n \n@@ -360,8 +360,8 @@ void partial_clone_register(\n \t */\n \tfilter_name = xstrfmt(\"remote.%s.partialclonefilter\", remote);\n \t/* NEEDSWORK: 'expand' result leaking??? */\n-\tgit_config_set(filter_name,\n-\t\t       expand_list_objects_filter_spec(filter_options));\n+\trepo_config_set(the_repository, filter_name,\n+\t\t\texpand_list_objects_filter_spec(filter_options));\n \tfree(filter_name);\n \n \t/* Make sure the config info are reset */\ndiff --git a/setup.c b/setup.c\nindex a05c348dcdf..98ddbf377f9 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -815,7 +815,7 @@ int upgrade_repository_format(int target_version)\n \t}\n \n \tstrbuf_addf(&repo_version, \"%d\", target_version);\n-\tgit_config_set(\"core.repositoryformatversion\", repo_version.buf);\n+\trepo_config_set(the_repository, \"core.repositoryformatversion\", repo_version.buf);\n \n \tret = 1;\n \n@@ -2233,14 +2233,14 @@ void initialize_repository_version(int hash_algo,\n \t\ttarget_version = GIT_REPO_VERSION_READ;\n \n \tif (hash_algo != GIT_HASH_SHA1_LEGACY && hash_algo != GIT_HASH_UNKNOWN)\n-\t\tgit_config_set(\"extensions.objectformat\",\n-\t\t\t       hash_algos[hash_algo].name);\n+\t\trepo_config_set(the_repository, \"extensions.objectformat\",\n+\t\t\t\thash_algos[hash_algo].name);\n \telse if (reinit)\n \t\trepo_config_set_gently(the_repository, \"extensions.objectformat\", NULL);\n \n \tif (ref_storage_format != REF_STORAGE_FORMAT_FILES)\n-\t\tgit_config_set(\"extensions.refstorage\",\n-\t\t\t       ref_storage_format_to_name(ref_storage_format));\n+\t\trepo_config_set(the_repository, \"extensions.refstorage\",\n+\t\t\t\tref_storage_format_to_name(ref_storage_format));\n \telse if (reinit)\n \t\trepo_config_set_gently(the_repository, \"extensions.refstorage\", NULL);\n \n@@ -2259,7 +2259,7 @@ void initialize_repository_version(int hash_algo,\n \t}\n \n \tstrbuf_addf(&repo_version, \"%d\", target_version);\n-\tgit_config_set(\"core.repositoryformatversion\", repo_version.buf);\n+\trepo_config_set(the_repository, \"core.repositoryformatversion\", repo_version.buf);\n \n \tstrbuf_release(&repo_version);\n }\n@@ -2375,17 +2375,17 @@ static int create_default_files(const char *template_path,\n \t\tif (filemode && !reinit && (st1.st_mode & S_IXUSR))\n \t\t\tfilemode = 0;\n \t}\n-\tgit_config_set(\"core.filemode\", filemode ? \"true\" : \"false\");\n+\trepo_config_set(the_repository, \"core.filemode\", filemode ? \"true\" : \"false\");\n \n \tif (is_bare_repository())\n-\t\tgit_config_set(\"core.bare\", \"true\");\n+\t\trepo_config_set(the_repository, \"core.bare\", \"true\");\n \telse {\n-\t\tgit_config_set(\"core.bare\", \"false\");\n+\t\trepo_config_set(the_repository, \"core.bare\", \"false\");\n \t\t/* allow template config file to override the default */\n \t\tif (repo_settings_get_log_all_ref_updates(the_repository) == LOG_REFS_UNSET)\n-\t\t\tgit_config_set(\"core.logallrefupdates\", \"true\");\n+\t\t\trepo_config_set(the_repository, \"core.logallrefupdates\", \"true\");\n \t\tif (needs_work_tree_config(original_git_dir, work_tree))\n-\t\t\tgit_config_set(\"core.worktree\", work_tree);\n+\t\t\trepo_config_set(the_repository, \"core.worktree\", work_tree);\n \t}\n \n \tif (!reinit) {\n@@ -2398,12 +2398,12 @@ static int create_default_files(const char *template_path,\n \t\t    S_ISLNK(st1.st_mode))\n \t\t\tunlink(path.buf); /* good */\n \t\telse\n-\t\t\tgit_config_set(\"core.symlinks\", \"false\");\n+\t\t\trepo_config_set(the_repository, \"core.symlinks\", \"false\");\n \n \t\t/* Check if the filesystem is case-insensitive */\n \t\trepo_git_path_replace(the_repository, &path, \"CoNfIg\");\n \t\tif (!access(path.buf, F_OK))\n-\t\t\tgit_config_set(\"core.ignorecase\", \"true\");\n+\t\t\trepo_config_set(the_repository, \"core.ignorecase\", \"true\");\n \t\tprobe_utf8_pathname_composition();\n \t}\n \n@@ -2639,8 +2639,8 @@ int init_db(const char *git_dir, const char *real_git_dir,\n \t\t\txsnprintf(buf, sizeof(buf), \"%d\", OLD_PERM_EVERYBODY);\n \t\telse\n \t\t\tBUG(\"invalid value for shared_repository\");\n-\t\tgit_config_set(\"core.sharedrepository\", buf);\n-\t\tgit_config_set(\"receive.denyNonFastforwards\", \"true\");\n+\t\trepo_config_set(the_repository, \"core.sharedrepository\", buf);\n+\t\trepo_config_set(the_repository, \"receive.denyNonFastforwards\", \"true\");\n \t}\n \n \tif (!(flags & INIT_DB_QUIET)) {\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522562","messageId":"20250723-pks-config-wo-the-repository-v2-15-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 15/21] config: drop `git_config_set_in_file_gently()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:36Z","receivedAt":"2025-07-23T14:09:18Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove\n`git_config_set_in_file_gently()`. All callsites are adjusted so that\nthey use `repo_config_set_in_file_gently(the_repository, ...)` instead.\nWhile some callsites might already have a repository available, this\nmechanical conversion is the exact same as the current situation and\nthus cannot cause any regression. Those sites should eventually be\ncleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/config.c            | 14 +++++++-------\n builtin/submodule--helper.c |  2 +-\n builtin/worktree.c          |  4 ++--\n config.h                    | 10 ----------\n sequencer.c                 | 28 ++++++++++++++--------------\n submodule-config.c          |  2 +-\n submodule.c                 |  2 +-\n worktree.c                  |  4 ++--\n 8 files changed, 28 insertions(+), 38 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex af5d79eadc0..f7e718c6702 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -970,8 +970,8 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix,\n \t\t\t\t\t\t\t     argv[0], value, value_pattern,\n \t\t\t\t\t\t\t     comment, flags);\n \t} else {\n-\t\tret = git_config_set_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t    argv[0], comment, value);\n+\t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t     argv[0], comment, value);\n \t\tif (ret == CONFIG_NOTHING_SET)\n \t\t\terror(_(\"cannot overwrite multiple values with a single value\\n\"\n \t\t\t\"       Use a regexp, --add or --replace-all to change %s.\"), argv[0]);\n@@ -1014,8 +1014,8 @@ static int cmd_config_unset(int argc, const char **argv, const char *prefix,\n \t\t\t\t\t\t\t     argv[0], NULL, value_pattern,\n \t\t\t\t\t\t\t     NULL, flags);\n \telse\n-\t\tret = git_config_set_in_file_gently(location_opts.source.file, argv[0],\n-\t\t\t\t\t\t    NULL, NULL);\n+\t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0],\n+\t\t\t\t\t\t     NULL, NULL);\n \n \tlocation_options_release(&location_opts);\n \treturn ret;\n@@ -1296,7 +1296,7 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)\n \t\tcheck_write(&location_opts.source);\n \t\tcheck_argc(argc, 2, 2);\n \t\tvalue = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);\n-\t\tret = git_config_set_in_file_gently(location_opts.source.file, argv[0], comment, value);\n+\t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0], comment, value);\n \t\tif (ret == CONFIG_NOTHING_SET)\n \t\t\terror(_(\"cannot overwrite multiple values with a single value\\n\"\n \t\t\t\"       Use a regexp, --add or --replace-all to change %s.\"), argv[0]);\n@@ -1354,8 +1354,8 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)\n \t\t\t\t\t\t\t\t     argv[0], NULL, argv[1],\n \t\t\t\t\t\t\t\t     NULL, flags);\n \t\telse\n-\t\t\tret = git_config_set_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t    argv[0], NULL, NULL);\n+\t\t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t     argv[0], NULL, NULL);\n \t}\n \telse if (actions == ACTION_UNSET_ALL) {\n \t\tcheck_write(&location_opts.source);\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 710a2a2004e..28f34f7bc18 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1280,7 +1280,7 @@ static void sync_submodule(const char *path, const char *prefix,\n \tsubmodule_to_gitdir(the_repository, &sb, path);\n \tstrbuf_addstr(&sb, \"/config\");\n \n-\tif (git_config_set_in_file_gently(sb.buf, remote_key, NULL, sub_origin_url))\n+\tif (repo_config_set_in_file_gently(the_repository, sb.buf, remote_key, NULL, sub_origin_url))\n \t\tdie(_(\"failed to update remote for submodule '%s'\"),\n \t\t      path);\n \ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex b1306248dec..fd517c82c44 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -384,8 +384,8 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)\n \t\t\terror(_(\"failed to unset '%s' in '%s'\"),\n \t\t\t\t\"core.bare\", to_file);\n \t\tif (!git_configset_get(&cs, \"core.worktree\") &&\n-\t\t\tgit_config_set_in_file_gently(to_file,\n-\t\t\t\t\t\t\t\"core.worktree\", NULL, NULL))\n+\t\t\trepo_config_set_in_file_gently(the_repository, to_file,\n+\t\t\t\t\t\t       \"core.worktree\", NULL, NULL))\n \t\t\terror(_(\"failed to unset '%s' in '%s'\"),\n \t\t\t\t\"core.worktree\", to_file);\n \ndiff --git a/config.h b/config.h\nindex 43d06c279e3..4e658e47f0a 100644\n--- a/config.h\n+++ b/config.h\n@@ -734,16 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)\n \treturn repo_config_get_pathname(the_repository, key, dest);\n }\n \n-static inline int git_config_set_in_file_gently(\n-\tconst char *config_filename,\n-\tconst char *key,\n-\tconst char *comment,\n-\tconst char *value)\n-{\n-\treturn repo_config_set_in_file_gently(the_repository, config_filename,\n-\t\t\t\t\t      key, comment, value);\n-}\n-\n static inline int git_config_set_multivar_in_file_gently(\n \tconst char *config_filename,\n \tconst char *key, const char *value,\ndiff --git a/sequencer.c b/sequencer.c\nindex f8d9bb69df8..8acb699f4f2 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -3650,57 +3650,57 @@ static int save_opts(struct replay_opts *opts)\n \tint res = 0;\n \n \tif (opts->no_commit)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.no-commit\", NULL, \"true\");\n \tif (opts->edit >= 0)\n-\t\tres |= git_config_set_in_file_gently(opts_file, \"options.edit\", NULL,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file, \"options.edit\", NULL,\n \t\t\t\t\t\t     opts->edit ? \"true\" : \"false\");\n \tif (opts->allow_empty)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.allow-empty\", NULL, \"true\");\n \tif (opts->allow_empty_message)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\"options.allow-empty-message\", NULL, \"true\");\n \tif (opts->drop_redundant_commits)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\"options.drop-redundant-commits\", NULL, \"true\");\n \tif (opts->keep_redundant_commits)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\"options.keep-redundant-commits\", NULL, \"true\");\n \tif (opts->signoff)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.signoff\", NULL, \"true\");\n \tif (opts->record_origin)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.record-origin\", NULL, \"true\");\n \tif (opts->allow_ff)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.allow-ff\", NULL, \"true\");\n \tif (opts->mainline) {\n \t\tstruct strbuf buf = STRBUF_INIT;\n \t\tstrbuf_addf(&buf, \"%d\", opts->mainline);\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.mainline\", NULL, buf.buf);\n \t\tstrbuf_release(&buf);\n \t}\n \tif (opts->strategy)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.strategy\", NULL, opts->strategy);\n \tif (opts->gpg_sign)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.gpg-sign\", NULL, opts->gpg_sign);\n \tfor (size_t i = 0; i < opts->xopts.nr; i++)\n \t\tres |= git_config_set_multivar_in_file_gently(opts_file,\n \t\t\t\t\"options.strategy-option\",\n \t\t\t\topts->xopts.v[i], \"^$\", NULL, 0);\n \tif (opts->allow_rerere_auto)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\"options.allow-rerere-auto\", NULL,\n \t\t\t\topts->allow_rerere_auto == RERERE_AUTOUPDATE ?\n \t\t\t\t\"true\" : \"false\");\n \n \tif (opts->explicit_cleanup)\n-\t\tres |= git_config_set_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\"options.default-msg-cleanup\", NULL,\n \t\t\t\tdescribe_cleanup_mode(opts->default_msg_cleanup));\n \treturn res;\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 70324da3830..1f19fe20774 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -983,7 +983,7 @@ int config_set_in_gitmodules_file_gently(const char *key, const char *value)\n {\n \tint ret;\n \n-\tret = git_config_set_in_file_gently(GITMODULES_FILE, key, NULL, value);\n+\tret = repo_config_set_in_file_gently(the_repository, GITMODULES_FILE, key, NULL, value);\n \tif (ret < 0)\n \t\t/* Maybe the user already did that, don't error out here */\n \t\twarning(_(\"Could not update .gitmodules entry %s\"), key);\ndiff --git a/submodule.c b/submodule.c\nindex f8373a9ea7d..fff3c755703 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -2058,7 +2058,7 @@ void submodule_unset_core_worktree(const struct submodule *sub)\n \tsubmodule_name_to_gitdir(&config_path, the_repository, sub->name);\n \tstrbuf_addstr(&config_path, \"/config\");\n \n-\tif (git_config_set_in_file_gently(config_path.buf, \"core.worktree\", NULL, NULL))\n+\tif (repo_config_set_in_file_gently(the_repository, config_path.buf, \"core.worktree\", NULL, NULL))\n \t\twarning(_(\"Could not unset core.worktree setting in submodule '%s'\"),\n \t\t\t  sub->path);\n \ndiff --git a/worktree.c b/worktree.c\nindex 981a2713374..a2a5f51f29f 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -991,9 +991,9 @@ int should_prune_worktree(const char *id, struct strbuf *reason, char **wtpath,\n static int move_config_setting(const char *key, const char *value,\n \t\t\t       const char *from_file, const char *to_file)\n {\n-\tif (git_config_set_in_file_gently(to_file, key, NULL, value))\n+\tif (repo_config_set_in_file_gently(the_repository, to_file, key, NULL, value))\n \t\treturn error(_(\"unable to set %s in '%s'\"), key, to_file);\n-\tif (git_config_set_in_file_gently(from_file, key, NULL, NULL))\n+\tif (repo_config_set_in_file_gently(the_repository, from_file, key, NULL, NULL))\n \t\treturn error(_(\"unable to unset %s in '%s'\"), key, from_file);\n \treturn 0;\n }\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522563","messageId":"20250723-pks-config-wo-the-repository-v2-16-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 16/21] config: drop `git_config_set_multivar_in_file_gently()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:37Z","receivedAt":"2025-07-23T14:09:21Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove\n`git_config_set_multivar_in_file_gently()`. All callsites are adjusted\nso that they use\n`repo_config_set_multivar_in_file_gently(the_repository, ...)` instead.\nWhile some callsites might already have a repository available, this\nmechanical conversion is the exact same as the current situation and\nthus cannot cause any regression. Those sites should eventually be\ncleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/config.c   | 44 ++++++++++++++++++++++----------------------\n builtin/gc.c       |  4 ++--\n builtin/worktree.c |  2 +-\n config.h           | 12 ------------\n sequencer.c        |  2 +-\n 5 files changed, 26 insertions(+), 38 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex f7e718c6702..59fb113b073 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -966,9 +966,9 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix,\n \tvalue = normalize_value(argv[0], argv[1], type, &default_kvi);\n \n \tif ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern) {\n-\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t     argv[0], value, value_pattern,\n-\t\t\t\t\t\t\t     comment, flags);\n+\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t      argv[0], value, value_pattern,\n+\t\t\t\t\t\t\t      comment, flags);\n \t} else {\n \t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,\n \t\t\t\t\t\t     argv[0], comment, value);\n@@ -1010,9 +1010,9 @@ static int cmd_config_unset(int argc, const char **argv, const char *prefix,\n \tcheck_write(&location_opts.source);\n \n \tif ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern)\n-\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t     argv[0], NULL, value_pattern,\n-\t\t\t\t\t\t\t     NULL, flags);\n+\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t      argv[0], NULL, value_pattern,\n+\t\t\t\t\t\t\t      NULL, flags);\n \telse\n \t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0],\n \t\t\t\t\t\t     NULL, NULL);\n@@ -1305,26 +1305,26 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)\n \t\tcheck_write(&location_opts.source);\n \t\tcheck_argc(argc, 2, 3);\n \t\tvalue = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);\n-\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t     argv[0], value, argv[2],\n-\t\t\t\t\t\t\t     comment, flags);\n+\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t      argv[0], value, argv[2],\n+\t\t\t\t\t\t\t      comment, flags);\n \t}\n \telse if (actions == ACTION_ADD) {\n \t\tcheck_write(&location_opts.source);\n \t\tcheck_argc(argc, 2, 2);\n \t\tvalue = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);\n-\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t     argv[0], value,\n-\t\t\t\t\t\t\t     CONFIG_REGEX_NONE,\n-\t\t\t\t\t\t\t     comment, flags);\n+\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t      argv[0], value,\n+\t\t\t\t\t\t\t      CONFIG_REGEX_NONE,\n+\t\t\t\t\t\t\t      comment, flags);\n \t}\n \telse if (actions == ACTION_REPLACE_ALL) {\n \t\tcheck_write(&location_opts.source);\n \t\tcheck_argc(argc, 2, 3);\n \t\tvalue = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);\n-\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t     argv[0], value, argv[2],\n-\t\t\t\t\t\t\t     comment, flags | CONFIG_FLAGS_MULTI_REPLACE);\n+\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t      argv[0], value, argv[2],\n+\t\t\t\t\t\t\t      comment, flags | CONFIG_FLAGS_MULTI_REPLACE);\n \t}\n \telse if (actions == ACTION_GET) {\n \t\tcheck_argc(argc, 1, 2);\n@@ -1350,9 +1350,9 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)\n \t\tcheck_write(&location_opts.source);\n \t\tcheck_argc(argc, 1, 2);\n \t\tif (argc == 2)\n-\t\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t\t     argv[0], NULL, argv[1],\n-\t\t\t\t\t\t\t\t     NULL, flags);\n+\t\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t\t      argv[0], NULL, argv[1],\n+\t\t\t\t\t\t\t\t      NULL, flags);\n \t\telse\n \t\t\tret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,\n \t\t\t\t\t\t\t     argv[0], NULL, NULL);\n@@ -1360,9 +1360,9 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)\n \telse if (actions == ACTION_UNSET_ALL) {\n \t\tcheck_write(&location_opts.source);\n \t\tcheck_argc(argc, 1, 2);\n-\t\tret = git_config_set_multivar_in_file_gently(location_opts.source.file,\n-\t\t\t\t\t\t\t     argv[0], NULL, argv[1],\n-\t\t\t\t\t\t\t     NULL, flags | CONFIG_FLAGS_MULTI_REPLACE);\n+\t\tret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,\n+\t\t\t\t\t\t\t      argv[0], NULL, argv[1],\n+\t\t\t\t\t\t\t      NULL, flags | CONFIG_FLAGS_MULTI_REPLACE);\n \t}\n \telse if (actions == ACTION_RENAME_SECTION) {\n \t\tcheck_write(&location_opts.source);\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex c0fe4e73087..183798f0dc9 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -1938,7 +1938,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,\n \t\t}\n \t\tif (!config_file)\n \t\t\tdie(_(\"$HOME not set\"));\n-\t\trc = git_config_set_multivar_in_file_gently(\n+\t\trc = repo_config_set_multivar_in_file_gently(the_repository,\n \t\t\tconfig_file, \"maintenance.repo\", maintpath,\n \t\t\tCONFIG_REGEX_NONE, NULL, 0);\n \t\tfree(global_config_file);\n@@ -2007,7 +2007,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi\n \t\t}\n \t\tif (!config_file)\n \t\t\tdie(_(\"$HOME not set\"));\n-\t\trc = git_config_set_multivar_in_file_gently(\n+\t\trc = repo_config_set_multivar_in_file_gently(the_repository,\n \t\t\tconfig_file, key, NULL, maintpath, NULL,\n \t\t\tCONFIG_FLAGS_MULTI_REPLACE | CONFIG_FLAGS_FIXED_VALUE);\n \t\tfree(global_config_file);\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex fd517c82c44..812774a5ca9 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -379,7 +379,7 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)\n \n \t\tif (!git_configset_get_bool(&cs, \"core.bare\", &bare) &&\n \t\t\tbare &&\n-\t\t\tgit_config_set_multivar_in_file_gently(\n+\t\t\trepo_config_set_multivar_in_file_gently(the_repository,\n \t\t\t\tto_file, \"core.bare\", NULL, \"true\", NULL, 0))\n \t\t\terror(_(\"failed to unset '%s' in '%s'\"),\n \t\t\t\t\"core.bare\", to_file);\ndiff --git a/config.h b/config.h\nindex 4e658e47f0a..e69592ada15 100644\n--- a/config.h\n+++ b/config.h\n@@ -734,18 +734,6 @@ static inline int git_config_get_pathname(const char *key, char **dest)\n \treturn repo_config_get_pathname(the_repository, key, dest);\n }\n \n-static inline int git_config_set_multivar_in_file_gently(\n-\tconst char *config_filename,\n-\tconst char *key, const char *value,\n-\tconst char *value_pattern,\n-\tconst char *comment,\n-\tunsigned flags)\n-{\n-\treturn repo_config_set_multivar_in_file_gently(the_repository, config_filename,\n-\t\t\t\t\t\t       key, value, value_pattern,\n-\t\t\t\t\t\t       comment, flags);\n-}\n-\n static inline void git_config_set_multivar_in_file(\n \tconst char *config_filename,\n \tconst char *key,\ndiff --git a/sequencer.c b/sequencer.c\nindex 8acb699f4f2..aaf2e4df64e 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -3690,7 +3690,7 @@ static int save_opts(struct replay_opts *opts)\n \t\tres |= repo_config_set_in_file_gently(the_repository, opts_file,\n \t\t\t\t\t\"options.gpg-sign\", NULL, opts->gpg_sign);\n \tfor (size_t i = 0; i < opts->xopts.nr; i++)\n-\t\tres |= git_config_set_multivar_in_file_gently(opts_file,\n+\t\tres |= repo_config_set_multivar_in_file_gently(the_repository, opts_file,\n \t\t\t\t\"options.strategy-option\",\n \t\t\t\topts->xopts.v[i], \"^$\", NULL, 0);\n \tif (opts->allow_rerere_auto)\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522564","messageId":"20250723-pks-config-wo-the-repository-v2-17-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 17/21] config: drop `git_config_get_multivar_gently()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:38Z","receivedAt":"2025-07-23T14:09:24Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove\n`git_config_get_multivar_gently()`. All callsites are adjusted so that\nthey use `repo_config_get_multivar_gently(the_repository, ...)` instead.\nWhile some callsites might already have a repository available, this\nmechanical conversion is the exact same as the current situation and\nthus cannot cause any regression. Those sites should eventually be\ncleaned up in a later patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n branch.c         | 2 +-\n builtin/clone.c  | 8 ++++----\n builtin/remote.c | 4 ++--\n config.h         | 7 -------\n scalar.c         | 6 +++---\n 5 files changed, 10 insertions(+), 17 deletions(-)\n\ndiff --git a/branch.c b/branch.c\nindex 3dc237adf6c..26be3583471 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -130,7 +130,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,\n \tif (repo_config_set_gently(the_repository, key.buf, NULL) < 0)\n \t\tgoto out_err;\n \tfor_each_string_list_item(item, remotes)\n-\t\tif (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)\n+\t\tif (repo_config_set_multivar_gently(the_repository, key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)\n \t\t\tgoto out_err;\n \n \tif (rebasing) {\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex f025a8f19e0..183297787cb 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -762,16 +762,16 @@ static int write_one_config(const char *key, const char *value,\n {\n \t/*\n \t * give git_clone_config a chance to write config values back to the\n-\t * environment, since git_config_set_multivar_gently only deals with\n+\t * environment, since repo_config_set_multivar_gently only deals with\n \t * config-file writes\n \t */\n \tint apply_failed = git_clone_config(key, value, ctx, data);\n \tif (apply_failed)\n \t\treturn apply_failed;\n \n-\treturn git_config_set_multivar_gently(key,\n-\t\t\t\t\t      value ? value : \"true\",\n-\t\t\t\t\t      CONFIG_REGEX_NONE, 0);\n+\treturn repo_config_set_multivar_gently(the_repository, key,\n+\t\t\t\t\t       value ? value : \"true\",\n+\t\t\t\t\t       CONFIG_REGEX_NONE, 0);\n }\n \n static void write_config(struct string_list *config)\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 827639e0398..dd340a33259 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -1633,8 +1633,8 @@ static int update(int argc, const char **argv, const char *prefix,\n \n static int remove_all_fetch_refspecs(const char *key)\n {\n-\treturn git_config_set_multivar_gently(key, NULL, NULL,\n-\t\t\t\t\t      CONFIG_FLAGS_MULTI_REPLACE);\n+\treturn repo_config_set_multivar_gently(the_repository, key, NULL, NULL,\n+\t\t\t\t\t       CONFIG_FLAGS_MULTI_REPLACE);\n }\n \n static void add_branches(struct remote *remote, const char **branches,\ndiff --git a/config.h b/config.h\nindex e69592ada15..a90b814292c 100644\n--- a/config.h\n+++ b/config.h\n@@ -745,13 +745,6 @@ static inline void git_config_set_multivar_in_file(\n \t\t\t\t\t key, value, value_pattern, flags);\n }\n \n-static inline int git_config_set_multivar_gently(const char *key, const char *value,\n-\t\t\t\t   const char *value_pattern, unsigned flags)\n-{\n-\treturn repo_config_set_multivar_gently(the_repository, key, value,\n-\t\t\t\t\t       value_pattern, flags);\n-}\n-\n static inline void git_config_set_multivar(const char *key, const char *value,\n \t\t\t     const char *value_pattern, unsigned flags)\n {\ndiff --git a/scalar.c b/scalar.c\nindex c09c5ca194e..4a373c133d8 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -196,9 +196,9 @@ static int set_recommended_config(int reconfigure)\n \tif (repo_config_get_string(the_repository, \"log.excludeDecoration\", &value)) {\n \t\ttrace2_data_string(\"scalar\", the_repository,\n \t\t\t\t   \"log.excludeDecoration\", \"created\");\n-\t\tif (git_config_set_multivar_gently(\"log.excludeDecoration\",\n-\t\t\t\t\t\t   \"refs/prefetch/*\",\n-\t\t\t\t\t\t   CONFIG_REGEX_NONE, 0))\n+\t\tif (repo_config_set_multivar_gently(the_repository, \"log.excludeDecoration\",\n+\t\t\t\t\t\t    \"refs/prefetch/*\",\n+\t\t\t\t\t\t    CONFIG_REGEX_NONE, 0))\n \t\t\treturn error(_(\"could not configure \"\n \t\t\t\t       \"log.excludeDecoration\"));\n \t} else {\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522565","messageId":"20250723-pks-config-wo-the-repository-v2-18-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 18/21] config: drop `git_config_set_multivar()` wrapper","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:39Z","receivedAt":"2025-07-23T14:09:27Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 036876a1067 (config: hide functions using `the_repository` by\ndefault, 2024-08-13) we have moved around a bunch of functions in the\nconfig subsystem that depend on `the_repository`. Those function have\nbeen converted into mere wrappers around their equivalent function that\ntakes in a repository as parameter, and the intent was that we'll\neventually remove those wrappers to make the dependency on the global\nrepository variable explicit at the callsite.\n\nFollow through with that intent and remove `git_config_set_multivar()`.\nAll callsites are adjusted so that they use\n`repo_config_set_multivar(the_repository, ...)` instead. While some\ncallsites might already have a repository available, this mechanical\nconversion is the exact same as the current situation and thus cannot\ncause any regression. Those sites should eventually be cleaned up in a\nlater patch series.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/branch.c |  4 ++--\n builtin/clone.c  |  2 +-\n builtin/remote.c | 20 ++++++++++----------\n config.h         |  7 -------\n 4 files changed, 13 insertions(+), 20 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 5de0691d18d..fa5ced452e5 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -987,10 +987,10 @@ int cmd_branch(int argc,\n \n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addf(&buf, \"branch.%s.remote\", branch->name);\n-\t\tgit_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);\n+\t\trepo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);\n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addf(&buf, \"branch.%s.merge\", branch->name);\n-\t\tgit_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);\n+\t\trepo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);\n \t\tstrbuf_release(&buf);\n \t} else if (!noncreate_actions && argc > 0 && argc <= 2) {\n \t\tconst char *branch_name = argv[0];\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 183297787cb..c990f398ef6 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -822,7 +822,7 @@ static void write_refspec_config(const char *src_ref_prefix,\n \t\t/* Configure the remote */\n \t\tif (value.len) {\n \t\t\tstrbuf_addf(&key, \"remote.%s.fetch\", remote_name);\n-\t\t\tgit_config_set_multivar(key.buf, value.buf, \"^$\", 0);\n+\t\t\trepo_config_set_multivar(the_repository, key.buf, value.buf, \"^$\", 0);\n \t\t\tstrbuf_reset(&key);\n \n \t\t\tif (option_mirror) {\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex dd340a33259..4c63a8bb576 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -132,7 +132,7 @@ static void add_branch(const char *key, const char *branchname,\n \telse\n \t\tstrbuf_addf(tmp, \"refs/heads/%s:refs/remotes/%s/%s\",\n \t\t\t\tbranchname, remotename, branchname);\n-\tgit_config_set_multivar(key, tmp->buf, \"^$\", 0);\n+\trepo_config_set_multivar(the_repository, key, tmp->buf, \"^$\", 0);\n }\n \n static const char mirror_advice[] =\n@@ -634,15 +634,15 @@ static int migrate_file(struct remote *remote)\n \n \tstrbuf_addf(&buf, \"remote.%s.url\", remote->name);\n \tfor (i = 0; i < remote->url.nr; i++)\n-\t\tgit_config_set_multivar(buf.buf, remote->url.v[i], \"^$\", 0);\n+\t\trepo_config_set_multivar(the_repository, buf.buf, remote->url.v[i], \"^$\", 0);\n \tstrbuf_reset(&buf);\n \tstrbuf_addf(&buf, \"remote.%s.push\", remote->name);\n \tfor (i = 0; i < remote->push.nr; i++)\n-\t\tgit_config_set_multivar(buf.buf, remote->push.items[i].raw, \"^$\", 0);\n+\t\trepo_config_set_multivar(the_repository, buf.buf, remote->push.items[i].raw, \"^$\", 0);\n \tstrbuf_reset(&buf);\n \tstrbuf_addf(&buf, \"remote.%s.fetch\", remote->name);\n \tfor (i = 0; i < remote->fetch.nr; i++)\n-\t\tgit_config_set_multivar(buf.buf, remote->fetch.items[i].raw, \"^$\", 0);\n+\t\trepo_config_set_multivar(the_repository, buf.buf, remote->fetch.items[i].raw, \"^$\", 0);\n #ifndef WITH_BREAKING_CHANGES\n \tif (remote->origin == REMOTE_REMOTES)\n \t\tunlink_or_warn(repo_git_path_replace(the_repository, &buf,\n@@ -771,7 +771,7 @@ static int mv(int argc, const char **argv, const char *prefix,\n \tif (oldremote->fetch.nr) {\n \t\tstrbuf_reset(&buf);\n \t\tstrbuf_addf(&buf, \"remote.%s.fetch\", rename.new_name);\n-\t\tgit_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);\n+\t\trepo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);\n \t\tstrbuf_addf(&old_remote_context, \":refs/remotes/%s/\", rename.old_name);\n \t\tfor (i = 0; i < oldremote->fetch.nr; i++) {\n \t\t\tchar *ptr;\n@@ -791,7 +791,7 @@ static int mv(int argc, const char **argv, const char *prefix,\n \t\t\t\t\t  \"\\tPlease update the configuration manually if necessary.\"),\n \t\t\t\t\tbuf2.buf);\n \n-\t\t\tgit_config_set_multivar(buf.buf, buf2.buf, \"^$\", 0);\n+\t\t\trepo_config_set_multivar(the_repository, buf.buf, buf2.buf, \"^$\", 0);\n \t\t}\n \t}\n \n@@ -1790,7 +1790,7 @@ static int set_url(int argc, const char **argv, const char *prefix,\n \t/* Special cases that add new entry. */\n \tif ((!oldurl && !delete_mode) || add_mode) {\n \t\tif (add_mode)\n-\t\t\tgit_config_set_multivar(name_buf.buf, newurl,\n+\t\t\trepo_config_set_multivar(the_repository, name_buf.buf, newurl,\n \t\t\t\t\t\t       \"^$\", 0);\n \t\telse\n \t\t\trepo_config_set(the_repository, name_buf.buf, newurl);\n@@ -1814,10 +1814,10 @@ static int set_url(int argc, const char **argv, const char *prefix,\n \tregfree(&old_regex);\n \n \tif (!delete_mode)\n-\t\tgit_config_set_multivar(name_buf.buf, newurl, oldurl, 0);\n+\t\trepo_config_set_multivar(the_repository, name_buf.buf, newurl, oldurl, 0);\n \telse\n-\t\tgit_config_set_multivar(name_buf.buf, NULL, oldurl,\n-\t\t\t\t\tCONFIG_FLAGS_MULTI_REPLACE);\n+\t\trepo_config_set_multivar(the_repository, name_buf.buf, NULL, oldurl,\n+\t\t\t\t\t CONFIG_FLAGS_MULTI_REPLACE);\n out:\n \tstrbuf_release(&name_buf);\n \treturn 0;\ndiff --git a/config.h b/config.h\nindex a90b814292c..61774f17db3 100644\n--- a/config.h\n+++ b/config.h\n@@ -744,13 +744,6 @@ static inline void git_config_set_multivar_in_file(\n \trepo_config_set_multivar_in_file(the_repository, config_filename,\n \t\t\t\t\t key, value, value_pattern, flags);\n }\n-\n-static inline void git_config_set_multivar(const char *key, const char *value,\n-\t\t\t     const char *value_pattern, unsigned flags)\n-{\n-\trepo_config_set_multivar(the_repository, key, value,\n-\t\t\t\t value_pattern, flags);\n-}\n # endif /* USE_THE_REPOSITORY_VARIABLE */\n \n #endif /* CONFIG_H */\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522566","messageId":"20250723-pks-config-wo-the-repository-v2-19-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 19/21] config: remove unused `the_repository` wrappers","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:40Z","receivedAt":"2025-07-23T14:09:31Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Remove the last couple of wrapper functions that implicitly depend on\n`the_repository`.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n config.h | 28 ----------------------------\n 1 file changed, 28 deletions(-)\n\ndiff --git a/config.h b/config.h\nindex 61774f17db3..87baf8eeffe 100644\n--- a/config.h\n+++ b/config.h\n@@ -718,32 +718,4 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l\n \tlookup_config(mapping, ARRAY_SIZE(mapping), var)\n int lookup_config(const char **mapping, int nr_mapping, const char *var);\n \n-# ifdef USE_THE_REPOSITORY_VARIABLE\n-static inline int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest)\n-{\n-\treturn repo_config_get_bool_or_int(the_repository, key, is_bool, dest);\n-}\n-\n-static inline int git_config_get_maybe_bool(const char *key, int *dest)\n-{\n-\treturn repo_config_get_maybe_bool(the_repository, key, dest);\n-}\n-\n-static inline int git_config_get_pathname(const char *key, char **dest)\n-{\n-\treturn repo_config_get_pathname(the_repository, key, dest);\n-}\n-\n-static inline void git_config_set_multivar_in_file(\n-\tconst char *config_filename,\n-\tconst char *key,\n-\tconst char *value,\n-\tconst char *value_pattern,\n-\tunsigned flags)\n-{\n-\trepo_config_set_multivar_in_file(the_repository, config_filename,\n-\t\t\t\t\t key, value, value_pattern, flags);\n-}\n-# endif /* USE_THE_REPOSITORY_VARIABLE */\n-\n #endif /* CONFIG_H */\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522567","messageId":"20250723-pks-config-wo-the-repository-v2-20-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 20/21] config: move Git config parsing into \"environment.c\"","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:41Z","receivedAt":"2025-07-23T14:09:34Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In \"config.c\" we host both the business logic to read and write config\nfiles as well as the logic to parse specific Git-related variables. On\nthe one hand this is mixing concerns, but even more importantly it means\nthat we cannot easily remove the dependency on `the_repository` in our\nconfig parsing logic.\n\nMove the logic into \"environment.c\". This file is a grab bag of all\nkinds of global state already, so it is quite a good fit. Furthermore,\nit also hosts most of the global variables that we're parsing the config\nvalues into, making this an even better fit.\n\nNote that there is one hidden change: in `parse_fsync_components()` we\nuse an `int` to iterate through `ARRAY_SIZE(fsync_component_names)`. But\nas -Wsign-compare warnings are enabled in this file this causes a\ncompiler warning. The issue is fixed by using a `size_t` instead.\n\nThis change allows us to drop the `USE_THE_REPOSITORY_VARIABLE`\ndeclaration.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n builtin/add.c                |   1 +\n builtin/check-ignore.c       |   1 +\n builtin/check-mailmap.c      |   1 +\n builtin/checkout--worker.c   |   1 +\n builtin/checkout-index.c     |   1 +\n builtin/clean.c              |   1 +\n builtin/commit-graph.c       |   1 +\n builtin/commit-tree.c        |   1 +\n builtin/count-objects.c      |   1 +\n builtin/credential.c         |   1 +\n builtin/fast-export.c        |   1 +\n builtin/for-each-ref.c       |   1 +\n builtin/fsmonitor--daemon.c  |   1 +\n builtin/grep.c               |   1 +\n builtin/hash-object.c        |   1 +\n builtin/help.c               |   1 +\n builtin/hook.c               |   1 +\n builtin/interpret-trailers.c |   1 +\n builtin/ls-files.c           |   1 +\n builtin/ls-tree.c            |   1 +\n builtin/merge-base.c         |   1 +\n builtin/merge-tree.c         |   1 +\n builtin/multi-pack-index.c   |   1 +\n builtin/pack-refs.c          |   1 +\n builtin/patch-id.c           |   1 +\n builtin/pull.c               |   1 +\n builtin/read-tree.c          |   1 +\n builtin/replace.c            |   1 +\n builtin/rm.c                 |   1 +\n builtin/send-pack.c          |   1 +\n builtin/show-ref.c           |   1 +\n builtin/symbolic-ref.c       |   1 +\n builtin/unpack-file.c        |   1 +\n builtin/update-ref.c         |   1 +\n builtin/update-server-info.c |   1 +\n builtin/var.c                |   1 +\n builtin/verify-commit.c      |   1 +\n builtin/verify-pack.c        |   1 +\n builtin/verify-tag.c         |   1 +\n builtin/write-tree.c         |   1 +\n commit-graph.c               |   1 +\n config.c                     | 511 ------------------------------------------\n config.h                     |   3 -\n environment.c                | 512 +++++++++++++++++++++++++++++++++++++++++++\n environment.h                |   3 +\n fsck.c                       |   1 +\n http-fetch.c                 |   1 +\n http.c                       |   1 +\n imap-send.c                  |   1 +\n mailinfo.c                   |   1 +\n reflog.c                     |   1 +\n rerere.c                     |   1 +\n t/helper/test-advise.c       |   1 +\n t/helper/test-read-cache.c   |   1 +\n xdiff-interface.c            |   1 +\n 55 files changed, 566 insertions(+), 514 deletions(-)\n\ndiff --git a/builtin/add.c b/builtin/add.c\nindex 7c292ffdc6c..88d1d330fa8 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -7,6 +7,7 @@\n #include \"builtin.h\"\n #include \"advice.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"lockfile.h\"\n #include \"editor.h\"\n #include \"dir.h\"\ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex 03033499cb0..644c9a414ff 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"quote.h\"\n #include \"pathspec.h\"\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex 634626c6728..9cc5c598302 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"ident.h\"\n #include \"mailmap.h\"\ndiff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c\nindex 27a7d4f0409..e0772b718b2 100644\n--- a/builtin/checkout--worker.c\n+++ b/builtin/checkout--worker.c\n@@ -4,6 +4,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"entry.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parallel-checkout.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/checkout-index.c b/builtin/checkout-index.c\nindex 7f74bc702fa..188128aebd9 100644\n--- a/builtin/checkout-index.c\n+++ b/builtin/checkout-index.c\n@@ -9,6 +9,7 @@\n \n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 5ee147c4acc..a1977b92dc8 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -13,6 +13,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"path.h\"\ndiff --git a/builtin/commit-graph.c b/builtin/commit-graph.c\nindex c5cc601844c..4992ac146e1 100644\n--- a/builtin/commit-graph.c\n+++ b/builtin/commit-graph.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"commit.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex 2f1df28d413..5189e685a7e 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -6,6 +6,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-name.h\"\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex 433daff805a..b1148a68fa8 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -7,6 +7,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"path.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/credential.c b/builtin/credential.c\nindex 52f172e80cb..a295c80b366 100644\n--- a/builtin/credential.c\n+++ b/builtin/credential.c\n@@ -3,6 +3,7 @@\n #include \"git-compat-util.h\"\n #include \"credential.h\"\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"config.h\"\n \n static const char usage_msg[] =\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 17027b859e0..66a3a98c938 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -9,6 +9,7 @@\n \n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c\nindex 3d2207ec773..a8f7f8c7625 100644\n--- a/builtin/for-each-ref.c\n+++ b/builtin/for-each-ref.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"commit.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"object.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c\nindex 469c62b555b..242c594646d 100644\n--- a/builtin/fsmonitor--daemon.c\n+++ b/builtin/fsmonitor--daemon.c\n@@ -5,6 +5,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"fsmonitor-ll.h\"\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 8fcb69dbf2c..5df65373337 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -9,6 +9,7 @@\n \n #include \"builtin.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"config.h\"\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex c3ad1e91c96..5d900a6b8c9 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -8,6 +8,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-file.h\"\ndiff --git a/builtin/help.c b/builtin/help.c\nindex d79ecd946a6..c09cbc8912d 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -6,6 +6,7 @@\n \n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"pager.h\"\ndiff --git a/builtin/hook.c b/builtin/hook.c\nindex 044c27aa95d..7afec380d2e 100644\n--- a/builtin/hook.c\n+++ b/builtin/hook.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hook.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c\nindex 3141c37b853..41b0750e5af 100644\n--- a/builtin/interpret-trailers.c\n+++ b/builtin/interpret-trailers.c\n@@ -6,6 +6,7 @@\n  */\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex ff975e7be06..c06a6f33e41 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -11,6 +11,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"convert.h\"\n+#include \"environment.h\"\n #include \"quote.h\"\n #include \"dir.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex 4ba84e51967..5d55731ca35 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -7,6 +7,7 @@\n #include \"builtin.h\"\n \n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-name.h\"\ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex 8fde35c1751..3f82781245b 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-name.h\"\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex 99a6495fd52..203f0e6456a 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n \n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"tree-walk.h\"\n #include \"xdiff-interface.h\"\n #include \"help.h\"\ndiff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c\nindex 9a113f0f1f3..d3b9e98be37 100644\n--- a/builtin/multi-pack-index.c\n+++ b/builtin/multi-pack-index.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"midx.h\"\ndiff --git a/builtin/pack-refs.c b/builtin/pack-refs.c\nindex e47bae1c803..5e28d0f9e80 100644\n--- a/builtin/pack-refs.c\n+++ b/builtin/pack-refs.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\ndiff --git a/builtin/patch-id.c b/builtin/patch-id.c\nindex a659f00531a..d26e9d0c1ea 100644\n--- a/builtin/patch-id.c\n+++ b/builtin/patch-id.c\n@@ -3,6 +3,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hash.h\"\n #include \"hex.h\"\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex 5ea51c31f58..e6d3535c3b5 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -11,6 +11,7 @@\n #include \"builtin.h\"\n #include \"advice.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"merge.h\"\ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex 00eef756e67..34f7a59f38e 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -6,6 +6,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 3fe39e9df73..19897ef927f 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -11,6 +11,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"editor.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex 8c0da7a3ce7..05d89e98c3c 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -9,6 +9,7 @@\n #include \"builtin.h\"\n #include \"advice.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/send-pack.c b/builtin/send-pack.c\nindex 28b69d26b48..8b81c8a8486 100644\n--- a/builtin/send-pack.c\n+++ b/builtin/send-pack.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"pkt-line.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/show-ref.c b/builtin/show-ref.c\nindex 414e55b92d5..0b6f9edf86c 100644\n--- a/builtin/show-ref.c\n+++ b/builtin/show-ref.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs/refs-internal.h\"\ndiff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c\nindex 5c4623067c5..231e41e715b 100644\n--- a/builtin/symbolic-ref.c\n+++ b/builtin/symbolic-ref.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"refs.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex ae871adc909..87877a9fabc 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"object-file.h\"\n #include \"object-name.h\"\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex cb936643243..195437e7c65 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -3,6 +3,7 @@\n \n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hash.h\"\n #include \"hex.h\"\ndiff --git a/builtin/update-server-info.c b/builtin/update-server-info.c\nindex ba702d30efd..4c12968a836 100644\n--- a/builtin/update-server-info.c\n+++ b/builtin/update-server-info.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"server-info.h\"\ndiff --git a/builtin/var.c b/builtin/var.c\nindex beeac12dccf..a2d790d4532 100644\n--- a/builtin/var.c\n+++ b/builtin/var.c\n@@ -11,6 +11,7 @@\n #include \"attr.h\"\n #include \"config.h\"\n #include \"editor.h\"\n+#include \"environment.h\"\n #include \"ident.h\"\n #include \"pager.h\"\n #include \"refs.h\"\ndiff --git a/builtin/verify-commit.c b/builtin/verify-commit.c\nindex 5f749a30daf..62398acd721 100644\n--- a/builtin/verify-commit.c\n+++ b/builtin/verify-commit.c\n@@ -7,6 +7,7 @@\n  */\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"object-name.h\"\n #include \"commit.h\"\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex d9f66f5e767..65fd6629a00 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -1,6 +1,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex ed1c40338fd..cd6bc11095d 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -7,6 +7,7 @@\n  */\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"tag.h\"\n #include \"object-name.h\"\ndiff --git a/builtin/write-tree.c b/builtin/write-tree.c\nindex 3465c70a48a..e3bd1a40dbf 100644\n--- a/builtin/write-tree.c\n+++ b/builtin/write-tree.c\n@@ -6,6 +6,7 @@\n #define USE_THE_REPOSITORY_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\ndiff --git a/commit-graph.c b/commit-graph.c\nindex bd7b6f5338b..e0d92b816f5 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -4,6 +4,7 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"csum-file.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/config.c b/config.c\nindex 285cab0ce2a..947fba3d8d4 100644\n--- a/config.c\n+++ b/config.c\n@@ -6,12 +6,10 @@\n  *\n  */\n \n-#define USE_THE_REPOSITORY_VARIABLE\n #define DISABLE_SIGN_COMPARE_WARNINGS\n \n #include \"git-compat-util.h\"\n #include \"abspath.h\"\n-#include \"advice.h\"\n #include \"date.h\"\n #include \"branch.h\"\n #include \"config.h\"\n@@ -20,11 +18,8 @@\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"git-zlib.h\"\n-#include \"ident.h\"\n #include \"repository.h\"\n #include \"lockfile.h\"\n-#include \"mailmap.h\"\n-#include \"attr.h\"\n #include \"exec-cmd.h\"\n #include \"strbuf.h\"\n #include \"quote.h\"\n@@ -32,7 +27,6 @@\n #include \"string-list.h\"\n #include \"object-name.h\"\n #include \"odb.h\"\n-#include \"pager.h\"\n #include \"path.h\"\n #include \"utf8.h\"\n #include \"color.h\"\n@@ -41,7 +35,6 @@\n #include \"strvec.h\"\n #include \"trace2.h\"\n #include \"wildmatch.h\"\n-#include \"ws.h\"\n #include \"write-or-die.h\"\n \n struct config_source {\n@@ -71,9 +64,6 @@ struct config_source {\n };\n #define CONFIG_SOURCE_INIT { 0 }\n \n-static int pack_compression_seen;\n-static int zlib_compression_seen;\n-\n /*\n  * Config that comes from trusted scopes, namely:\n  * - CONFIG_SCOPE_SYSTEM (e.g. /etc/gitconfig)\n@@ -1262,80 +1252,6 @@ double git_config_double(const char *name, const char *value,\n \treturn ret;\n }\n \n-static const struct fsync_component_name {\n-\tconst char *name;\n-\tenum fsync_component component_bits;\n-} fsync_component_names[] = {\n-\t{ \"loose-object\", FSYNC_COMPONENT_LOOSE_OBJECT },\n-\t{ \"pack\", FSYNC_COMPONENT_PACK },\n-\t{ \"pack-metadata\", FSYNC_COMPONENT_PACK_METADATA },\n-\t{ \"commit-graph\", FSYNC_COMPONENT_COMMIT_GRAPH },\n-\t{ \"index\", FSYNC_COMPONENT_INDEX },\n-\t{ \"objects\", FSYNC_COMPONENTS_OBJECTS },\n-\t{ \"reference\", FSYNC_COMPONENT_REFERENCE },\n-\t{ \"derived-metadata\", FSYNC_COMPONENTS_DERIVED_METADATA },\n-\t{ \"committed\", FSYNC_COMPONENTS_COMMITTED },\n-\t{ \"added\", FSYNC_COMPONENTS_ADDED },\n-\t{ \"all\", FSYNC_COMPONENTS_ALL },\n-};\n-\n-static enum fsync_component parse_fsync_components(const char *var, const char *string)\n-{\n-\tenum fsync_component current = FSYNC_COMPONENTS_PLATFORM_DEFAULT;\n-\tenum fsync_component positive = 0, negative = 0;\n-\n-\twhile (string) {\n-\t\tint i;\n-\t\tsize_t len;\n-\t\tconst char *ep;\n-\t\tint negated = 0;\n-\t\tint found = 0;\n-\n-\t\tstring = string + strspn(string, \", \\t\\n\\r\");\n-\t\tep = strchrnul(string, ',');\n-\t\tlen = ep - string;\n-\t\tif (!strcmp(string, \"none\")) {\n-\t\t\tcurrent = FSYNC_COMPONENT_NONE;\n-\t\t\tgoto next_name;\n-\t\t}\n-\n-\t\tif (*string == '-') {\n-\t\t\tnegated = 1;\n-\t\t\tstring++;\n-\t\t\tlen--;\n-\t\t\tif (!len)\n-\t\t\t\twarning(_(\"invalid value for variable %s\"), var);\n-\t\t}\n-\n-\t\tif (!len)\n-\t\t\tbreak;\n-\n-\t\tfor (i = 0; i < ARRAY_SIZE(fsync_component_names); ++i) {\n-\t\t\tconst struct fsync_component_name *n = &fsync_component_names[i];\n-\n-\t\t\tif (strncmp(n->name, string, len))\n-\t\t\t\tcontinue;\n-\n-\t\t\tfound = 1;\n-\t\t\tif (negated)\n-\t\t\t\tnegative |= n->component_bits;\n-\t\t\telse\n-\t\t\t\tpositive |= n->component_bits;\n-\t\t}\n-\n-\t\tif (!found) {\n-\t\t\tchar *component = xstrndup(string, len);\n-\t\t\twarning(_(\"ignoring unknown core.fsync component '%s'\"), component);\n-\t\t\tfree(component);\n-\t\t}\n-\n-next_name:\n-\t\tstring = ep;\n-\t}\n-\n-\treturn (current & ~negative) | positive;\n-}\n-\n int git_config_bool_or_int(const char *name, const char *value,\n \t\t\t   const struct key_value_info *kvi, int *is_bool)\n {\n@@ -1393,433 +1309,6 @@ int git_config_color(char *dest, const char *var, const char *value)\n \treturn 0;\n }\n \n-static int git_default_core_config(const char *var, const char *value,\n-\t\t\t\t   const struct config_context *ctx, void *cb)\n-{\n-\t/* This needs a better name */\n-\tif (!strcmp(var, \"core.filemode\")) {\n-\t\ttrust_executable_bit = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\tif (!strcmp(var, \"core.trustctime\")) {\n-\t\ttrust_ctime = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\tif (!strcmp(var, \"core.checkstat\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\tif (!strcasecmp(value, \"default\"))\n-\t\t\tcheck_stat = 1;\n-\t\telse if (!strcasecmp(value, \"minimal\"))\n-\t\t\tcheck_stat = 0;\n-\t\telse\n-\t\t\treturn error(_(\"invalid value for '%s': '%s'\"),\n-\t\t\t\t     var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"core.quotepath\")) {\n-\t\tquote_path_fully = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.symlinks\")) {\n-\t\thas_symlinks = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.ignorecase\")) {\n-\t\tignore_case = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.attributesfile\")) {\n-\t\tFREE_AND_NULL(git_attributes_file);\n-\t\treturn git_config_pathname(&git_attributes_file, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"core.bare\")) {\n-\t\tis_bare_repository_cfg = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.ignorestat\")) {\n-\t\tassume_unchanged = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.abbrev\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\tif (!strcasecmp(value, \"auto\"))\n-\t\t\tdefault_abbrev = -1;\n-\t\telse if (!git_parse_maybe_bool_text(value))\n-\t\t\tdefault_abbrev = GIT_MAX_HEXSZ;\n-\t\telse {\n-\t\t\tint abbrev = git_config_int(var, value, ctx->kvi);\n-\t\t\tif (abbrev < minimum_abbrev)\n-\t\t\t\treturn error(_(\"abbrev length out of range: %d\"), abbrev);\n-\t\t\tdefault_abbrev = abbrev;\n-\t\t}\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.disambiguate\"))\n-\t\treturn set_disambiguate_hint_config(var, value);\n-\n-\tif (!strcmp(var, \"core.loosecompression\")) {\n-\t\tint level = git_config_int(var, value, ctx->kvi);\n-\t\tif (level == -1)\n-\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n-\t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n-\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n-\t\tzlib_compression_level = level;\n-\t\tzlib_compression_seen = 1;\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.compression\")) {\n-\t\tint level = git_config_int(var, value, ctx->kvi);\n-\t\tif (level == -1)\n-\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n-\t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n-\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n-\t\tif (!zlib_compression_seen)\n-\t\t\tzlib_compression_level = level;\n-\t\tif (!pack_compression_seen)\n-\t\t\tpack_compression_level = level;\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.autocrlf\")) {\n-\t\tif (value && !strcasecmp(value, \"input\")) {\n-\t\t\tauto_crlf = AUTO_CRLF_INPUT;\n-\t\t\treturn 0;\n-\t\t}\n-\t\tauto_crlf = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.safecrlf\")) {\n-\t\tint eol_rndtrp_die;\n-\t\tif (value && !strcasecmp(value, \"warn\")) {\n-\t\t\tglobal_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n-\t\t\treturn 0;\n-\t\t}\n-\t\teol_rndtrp_die = git_config_bool(var, value);\n-\t\tglobal_conv_flags_eol = eol_rndtrp_die ?\n-\t\t\tCONV_EOL_RNDTRP_DIE : 0;\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.eol\")) {\n-\t\tif (value && !strcasecmp(value, \"lf\"))\n-\t\t\tcore_eol = EOL_LF;\n-\t\telse if (value && !strcasecmp(value, \"crlf\"))\n-\t\t\tcore_eol = EOL_CRLF;\n-\t\telse if (value && !strcasecmp(value, \"native\"))\n-\t\t\tcore_eol = EOL_NATIVE;\n-\t\telse\n-\t\t\tcore_eol = EOL_UNSET;\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.checkroundtripencoding\")) {\n-\t\tFREE_AND_NULL(check_roundtrip_encoding);\n-\t\treturn git_config_string(&check_roundtrip_encoding, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"core.editor\")) {\n-\t\tFREE_AND_NULL(editor_program);\n-\t\treturn git_config_string(&editor_program, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"core.commentchar\") ||\n-\t    !strcmp(var, \"core.commentstring\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\telse if (!strcasecmp(value, \"auto\"))\n-\t\t\tauto_comment_line_char = 1;\n-\t\telse if (value[0]) {\n-\t\t\tif (strchr(value, '\\n'))\n-\t\t\t\treturn error(_(\"%s cannot contain newline\"), var);\n-\t\t\tcomment_line_str = value;\n-\t\t\tFREE_AND_NULL(comment_line_str_to_free);\n-\t\t\tauto_comment_line_char = 0;\n-\t\t} else\n-\t\t\treturn error(_(\"%s must have at least one character\"), var);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.askpass\")) {\n-\t\tFREE_AND_NULL(askpass_program);\n-\t\treturn git_config_string(&askpass_program, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"core.excludesfile\")) {\n-\t\tFREE_AND_NULL(excludes_file);\n-\t\treturn git_config_pathname(&excludes_file, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"core.whitespace\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\twhitespace_rule_cfg = parse_whitespace_rule(value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.fsync\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\tfsync_components = parse_fsync_components(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.fsyncmethod\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\tif (!strcmp(value, \"fsync\"))\n-\t\t\tfsync_method = FSYNC_METHOD_FSYNC;\n-\t\telse if (!strcmp(value, \"writeout-only\"))\n-\t\t\tfsync_method = FSYNC_METHOD_WRITEOUT_ONLY;\n-\t\telse if (!strcmp(value, \"batch\"))\n-\t\t\tfsync_method = FSYNC_METHOD_BATCH;\n-\t\telse\n-\t\t\twarning(_(\"ignoring unknown core.fsyncMethod value '%s'\"), value);\n-\n-\t}\n-\n-\tif (!strcmp(var, \"core.fsyncobjectfiles\")) {\n-\t\tif (fsync_object_files < 0)\n-\t\t\twarning(_(\"core.fsyncObjectFiles is deprecated; use core.fsync instead\"));\n-\t\tfsync_object_files = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.createobject\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\tif (!strcmp(value, \"rename\"))\n-\t\t\tobject_creation_mode = OBJECT_CREATION_USES_RENAMES;\n-\t\telse if (!strcmp(value, \"link\"))\n-\t\t\tobject_creation_mode = OBJECT_CREATION_USES_HARDLINKS;\n-\t\telse\n-\t\t\tdie(_(\"invalid mode for object creation: %s\"), value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.sparsecheckout\")) {\n-\t\tcore_apply_sparse_checkout = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.sparsecheckoutcone\")) {\n-\t\tcore_sparse_checkout_cone = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.precomposeunicode\")) {\n-\t\tprecomposed_unicode = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.protecthfs\")) {\n-\t\tprotect_hfs = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.protectntfs\")) {\n-\t\tprotect_ntfs = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"core.maxtreedepth\")) {\n-\t\tmax_allowed_tree_depth = git_config_int(var, value, ctx->kvi);\n-\t\treturn 0;\n-\t}\n-\n-\t/* Add other config variables here and to Documentation/config.adoc. */\n-\treturn platform_core_config(var, value, ctx, cb);\n-}\n-\n-static int git_default_sparse_config(const char *var, const char *value)\n-{\n-\tif (!strcmp(var, \"sparse.expectfilesoutsideofpatterns\")) {\n-\t\tsparse_expect_files_outside_of_patterns = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\n-\t/* Add other config variables here and to Documentation/config/sparse.adoc. */\n-\treturn 0;\n-}\n-\n-static int git_default_i18n_config(const char *var, const char *value)\n-{\n-\tif (!strcmp(var, \"i18n.commitencoding\")) {\n-\t\tFREE_AND_NULL(git_commit_encoding);\n-\t\treturn git_config_string(&git_commit_encoding, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"i18n.logoutputencoding\")) {\n-\t\tFREE_AND_NULL(git_log_output_encoding);\n-\t\treturn git_config_string(&git_log_output_encoding, var, value);\n-\t}\n-\n-\t/* Add other config variables here and to Documentation/config.adoc. */\n-\treturn 0;\n-}\n-\n-static int git_default_branch_config(const char *var, const char *value)\n-{\n-\tif (!strcmp(var, \"branch.autosetupmerge\")) {\n-\t\tif (value && !strcmp(value, \"always\")) {\n-\t\t\tgit_branch_track = BRANCH_TRACK_ALWAYS;\n-\t\t\treturn 0;\n-\t\t} else if (value && !strcmp(value, \"inherit\")) {\n-\t\t\tgit_branch_track = BRANCH_TRACK_INHERIT;\n-\t\t\treturn 0;\n-\t\t} else if (value && !strcmp(value, \"simple\")) {\n-\t\t\tgit_branch_track = BRANCH_TRACK_SIMPLE;\n-\t\t\treturn 0;\n-\t\t}\n-\t\tgit_branch_track = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n-\tif (!strcmp(var, \"branch.autosetuprebase\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\telse if (!strcmp(value, \"never\"))\n-\t\t\tautorebase = AUTOREBASE_NEVER;\n-\t\telse if (!strcmp(value, \"local\"))\n-\t\t\tautorebase = AUTOREBASE_LOCAL;\n-\t\telse if (!strcmp(value, \"remote\"))\n-\t\t\tautorebase = AUTOREBASE_REMOTE;\n-\t\telse if (!strcmp(value, \"always\"))\n-\t\t\tautorebase = AUTOREBASE_ALWAYS;\n-\t\telse\n-\t\t\treturn error(_(\"malformed value for %s\"), var);\n-\t\treturn 0;\n-\t}\n-\n-\t/* Add other config variables here and to Documentation/config.adoc. */\n-\treturn 0;\n-}\n-\n-static int git_default_push_config(const char *var, const char *value)\n-{\n-\tif (!strcmp(var, \"push.default\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\telse if (!strcmp(value, \"nothing\"))\n-\t\t\tpush_default = PUSH_DEFAULT_NOTHING;\n-\t\telse if (!strcmp(value, \"matching\"))\n-\t\t\tpush_default = PUSH_DEFAULT_MATCHING;\n-\t\telse if (!strcmp(value, \"simple\"))\n-\t\t\tpush_default = PUSH_DEFAULT_SIMPLE;\n-\t\telse if (!strcmp(value, \"upstream\"))\n-\t\t\tpush_default = PUSH_DEFAULT_UPSTREAM;\n-\t\telse if (!strcmp(value, \"tracking\")) /* deprecated */\n-\t\t\tpush_default = PUSH_DEFAULT_UPSTREAM;\n-\t\telse if (!strcmp(value, \"current\"))\n-\t\t\tpush_default = PUSH_DEFAULT_CURRENT;\n-\t\telse {\n-\t\t\terror(_(\"malformed value for %s: %s\"), var, value);\n-\t\t\treturn error(_(\"must be one of nothing, matching, simple, \"\n-\t\t\t\t       \"upstream or current\"));\n-\t\t}\n-\t\treturn 0;\n-\t}\n-\n-\t/* Add other config variables here and to Documentation/config.adoc. */\n-\treturn 0;\n-}\n-\n-static int git_default_mailmap_config(const char *var, const char *value)\n-{\n-\tif (!strcmp(var, \"mailmap.file\")) {\n-\t\tFREE_AND_NULL(git_mailmap_file);\n-\t\treturn git_config_pathname(&git_mailmap_file, var, value);\n-\t}\n-\n-\tif (!strcmp(var, \"mailmap.blob\")) {\n-\t\tFREE_AND_NULL(git_mailmap_blob);\n-\t\treturn git_config_string(&git_mailmap_blob, var, value);\n-\t}\n-\n-\t/* Add other config variables here and to Documentation/config.adoc. */\n-\treturn 0;\n-}\n-\n-static int git_default_attr_config(const char *var, const char *value)\n-{\n-\tif (!strcmp(var, \"attr.tree\")) {\n-\t\tFREE_AND_NULL(git_attr_tree);\n-\t\treturn git_config_string(&git_attr_tree, var, value);\n-\t}\n-\n-\t/*\n-\t * Add other attribute related config variables here and to\n-\t * Documentation/config/attr.adoc.\n-\t */\n-\treturn 0;\n-}\n-\n-int git_default_config(const char *var, const char *value,\n-\t\t       const struct config_context *ctx, void *cb)\n-{\n-\tif (starts_with(var, \"core.\"))\n-\t\treturn git_default_core_config(var, value, ctx, cb);\n-\n-\tif (starts_with(var, \"user.\") ||\n-\t    starts_with(var, \"author.\") ||\n-\t    starts_with(var, \"committer.\"))\n-\t\treturn git_ident_config(var, value, ctx, cb);\n-\n-\tif (starts_with(var, \"i18n.\"))\n-\t\treturn git_default_i18n_config(var, value);\n-\n-\tif (starts_with(var, \"branch.\"))\n-\t\treturn git_default_branch_config(var, value);\n-\n-\tif (starts_with(var, \"push.\"))\n-\t\treturn git_default_push_config(var, value);\n-\n-\tif (starts_with(var, \"mailmap.\"))\n-\t\treturn git_default_mailmap_config(var, value);\n-\n-\tif (starts_with(var, \"attr.\"))\n-\t\treturn git_default_attr_config(var, value);\n-\n-\tif (starts_with(var, \"advice.\") || starts_with(var, \"color.advice\"))\n-\t\treturn git_default_advice_config(var, value);\n-\n-\tif (!strcmp(var, \"pager.color\") || !strcmp(var, \"color.pager\")) {\n-\t\tpager_use_color = git_config_bool(var,value);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"pack.packsizelimit\")) {\n-\t\tpack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);\n-\t\treturn 0;\n-\t}\n-\n-\tif (!strcmp(var, \"pack.compression\")) {\n-\t\tint level = git_config_int(var, value, ctx->kvi);\n-\t\tif (level == -1)\n-\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n-\t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n-\t\t\tdie(_(\"bad pack compression level %d\"), level);\n-\t\tpack_compression_level = level;\n-\t\tpack_compression_seen = 1;\n-\t\treturn 0;\n-\t}\n-\n-\tif (starts_with(var, \"sparse.\"))\n-\t\treturn git_default_sparse_config(var, value);\n-\n-\t/* Add other config variables here and to Documentation/config.adoc. */\n-\treturn 0;\n-}\n-\n /*\n  * All source specific fields in the union, die_on_error, name and the callbacks\n  * fgetc, ungetc, ftell of top need to be initialized before calling\ndiff --git a/config.h b/config.h\nindex 87baf8eeffe..65fc47966e6 100644\n--- a/config.h\n+++ b/config.h\n@@ -165,9 +165,6 @@ struct config_context {\n typedef int (*config_fn_t)(const char *, const char *,\n \t\t\t   const struct config_context *, void *);\n \n-int git_default_config(const char *, const char *,\n-\t\t       const struct config_context *, void *);\n-\n /**\n  * Read a specific file in git-config format.\n  * This function takes the same callback and data parameters as `repo_config`.\ndiff --git a/environment.c b/environment.c\nindex 7c2480b22e5..ae1427bb9e8 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -12,22 +12,34 @@\n \n #include \"git-compat-util.h\"\n #include \"abspath.h\"\n+#include \"advice.h\"\n+#include \"attr.h\"\n #include \"branch.h\"\n+#include \"color.h\"\n #include \"convert.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"git-zlib.h\"\n+#include \"ident.h\"\n+#include \"mailmap.h\"\n+#include \"object-name.h\"\n #include \"repository.h\"\n #include \"config.h\"\n #include \"refs.h\"\n #include \"fmt-merge-msg.h\"\n #include \"commit.h\"\n #include \"strvec.h\"\n+#include \"pager.h\"\n #include \"path.h\"\n+#include \"quote.h\"\n #include \"chdir-notify.h\"\n #include \"setup.h\"\n+#include \"ws.h\"\n #include \"write-or-die.h\"\n \n+static int pack_compression_seen;\n+static int zlib_compression_seen;\n+\n int trust_executable_bit = 1;\n int trust_ctime = 1;\n int check_stat = 1;\n@@ -231,3 +243,503 @@ int print_sha1_ellipsis(void)\n \t}\n \treturn cached_result;\n }\n+\n+static const struct fsync_component_name {\n+\tconst char *name;\n+\tenum fsync_component component_bits;\n+} fsync_component_names[] = {\n+\t{ \"loose-object\", FSYNC_COMPONENT_LOOSE_OBJECT },\n+\t{ \"pack\", FSYNC_COMPONENT_PACK },\n+\t{ \"pack-metadata\", FSYNC_COMPONENT_PACK_METADATA },\n+\t{ \"commit-graph\", FSYNC_COMPONENT_COMMIT_GRAPH },\n+\t{ \"index\", FSYNC_COMPONENT_INDEX },\n+\t{ \"objects\", FSYNC_COMPONENTS_OBJECTS },\n+\t{ \"reference\", FSYNC_COMPONENT_REFERENCE },\n+\t{ \"derived-metadata\", FSYNC_COMPONENTS_DERIVED_METADATA },\n+\t{ \"committed\", FSYNC_COMPONENTS_COMMITTED },\n+\t{ \"added\", FSYNC_COMPONENTS_ADDED },\n+\t{ \"all\", FSYNC_COMPONENTS_ALL },\n+};\n+\n+static enum fsync_component parse_fsync_components(const char *var, const char *string)\n+{\n+\tenum fsync_component current = FSYNC_COMPONENTS_PLATFORM_DEFAULT;\n+\tenum fsync_component positive = 0, negative = 0;\n+\n+\twhile (string) {\n+\t\tsize_t len;\n+\t\tconst char *ep;\n+\t\tint negated = 0;\n+\t\tint found = 0;\n+\n+\t\tstring = string + strspn(string, \", \\t\\n\\r\");\n+\t\tep = strchrnul(string, ',');\n+\t\tlen = ep - string;\n+\t\tif (!strcmp(string, \"none\")) {\n+\t\t\tcurrent = FSYNC_COMPONENT_NONE;\n+\t\t\tgoto next_name;\n+\t\t}\n+\n+\t\tif (*string == '-') {\n+\t\t\tnegated = 1;\n+\t\t\tstring++;\n+\t\t\tlen--;\n+\t\t\tif (!len)\n+\t\t\t\twarning(_(\"invalid value for variable %s\"), var);\n+\t\t}\n+\n+\t\tif (!len)\n+\t\t\tbreak;\n+\n+\t\tfor (size_t i = 0; i < ARRAY_SIZE(fsync_component_names); ++i) {\n+\t\t\tconst struct fsync_component_name *n = &fsync_component_names[i];\n+\n+\t\t\tif (strncmp(n->name, string, len))\n+\t\t\t\tcontinue;\n+\n+\t\t\tfound = 1;\n+\t\t\tif (negated)\n+\t\t\t\tnegative |= n->component_bits;\n+\t\t\telse\n+\t\t\t\tpositive |= n->component_bits;\n+\t\t}\n+\n+\t\tif (!found) {\n+\t\t\tchar *component = xstrndup(string, len);\n+\t\t\twarning(_(\"ignoring unknown core.fsync component '%s'\"), component);\n+\t\t\tfree(component);\n+\t\t}\n+\n+next_name:\n+\t\tstring = ep;\n+\t}\n+\n+\treturn (current & ~negative) | positive;\n+}\n+\n+static int git_default_core_config(const char *var, const char *value,\n+\t\t\t\t   const struct config_context *ctx, void *cb)\n+{\n+\t/* This needs a better name */\n+\tif (!strcmp(var, \"core.filemode\")) {\n+\t\ttrust_executable_bit = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\tif (!strcmp(var, \"core.trustctime\")) {\n+\t\ttrust_ctime = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\tif (!strcmp(var, \"core.checkstat\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\tif (!strcasecmp(value, \"default\"))\n+\t\t\tcheck_stat = 1;\n+\t\telse if (!strcasecmp(value, \"minimal\"))\n+\t\t\tcheck_stat = 0;\n+\t\telse\n+\t\t\treturn error(_(\"invalid value for '%s': '%s'\"),\n+\t\t\t\t     var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"core.quotepath\")) {\n+\t\tquote_path_fully = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.symlinks\")) {\n+\t\thas_symlinks = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.ignorecase\")) {\n+\t\tignore_case = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.attributesfile\")) {\n+\t\tFREE_AND_NULL(git_attributes_file);\n+\t\treturn git_config_pathname(&git_attributes_file, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"core.bare\")) {\n+\t\tis_bare_repository_cfg = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.ignorestat\")) {\n+\t\tassume_unchanged = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.abbrev\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\tif (!strcasecmp(value, \"auto\"))\n+\t\t\tdefault_abbrev = -1;\n+\t\telse if (!git_parse_maybe_bool_text(value))\n+\t\t\tdefault_abbrev = GIT_MAX_HEXSZ;\n+\t\telse {\n+\t\t\tint abbrev = git_config_int(var, value, ctx->kvi);\n+\t\t\tif (abbrev < minimum_abbrev)\n+\t\t\t\treturn error(_(\"abbrev length out of range: %d\"), abbrev);\n+\t\t\tdefault_abbrev = abbrev;\n+\t\t}\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.disambiguate\"))\n+\t\treturn set_disambiguate_hint_config(var, value);\n+\n+\tif (!strcmp(var, \"core.loosecompression\")) {\n+\t\tint level = git_config_int(var, value, ctx->kvi);\n+\t\tif (level == -1)\n+\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n+\t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n+\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n+\t\tzlib_compression_level = level;\n+\t\tzlib_compression_seen = 1;\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.compression\")) {\n+\t\tint level = git_config_int(var, value, ctx->kvi);\n+\t\tif (level == -1)\n+\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n+\t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n+\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n+\t\tif (!zlib_compression_seen)\n+\t\t\tzlib_compression_level = level;\n+\t\tif (!pack_compression_seen)\n+\t\t\tpack_compression_level = level;\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.autocrlf\")) {\n+\t\tif (value && !strcasecmp(value, \"input\")) {\n+\t\t\tauto_crlf = AUTO_CRLF_INPUT;\n+\t\t\treturn 0;\n+\t\t}\n+\t\tauto_crlf = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.safecrlf\")) {\n+\t\tint eol_rndtrp_die;\n+\t\tif (value && !strcasecmp(value, \"warn\")) {\n+\t\t\tglobal_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n+\t\t\treturn 0;\n+\t\t}\n+\t\teol_rndtrp_die = git_config_bool(var, value);\n+\t\tglobal_conv_flags_eol = eol_rndtrp_die ?\n+\t\t\tCONV_EOL_RNDTRP_DIE : 0;\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.eol\")) {\n+\t\tif (value && !strcasecmp(value, \"lf\"))\n+\t\t\tcore_eol = EOL_LF;\n+\t\telse if (value && !strcasecmp(value, \"crlf\"))\n+\t\t\tcore_eol = EOL_CRLF;\n+\t\telse if (value && !strcasecmp(value, \"native\"))\n+\t\t\tcore_eol = EOL_NATIVE;\n+\t\telse\n+\t\t\tcore_eol = EOL_UNSET;\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.checkroundtripencoding\")) {\n+\t\tFREE_AND_NULL(check_roundtrip_encoding);\n+\t\treturn git_config_string(&check_roundtrip_encoding, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"core.editor\")) {\n+\t\tFREE_AND_NULL(editor_program);\n+\t\treturn git_config_string(&editor_program, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"core.commentchar\") ||\n+\t    !strcmp(var, \"core.commentstring\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\telse if (!strcasecmp(value, \"auto\"))\n+\t\t\tauto_comment_line_char = 1;\n+\t\telse if (value[0]) {\n+\t\t\tif (strchr(value, '\\n'))\n+\t\t\t\treturn error(_(\"%s cannot contain newline\"), var);\n+\t\t\tcomment_line_str = value;\n+\t\t\tFREE_AND_NULL(comment_line_str_to_free);\n+\t\t\tauto_comment_line_char = 0;\n+\t\t} else\n+\t\t\treturn error(_(\"%s must have at least one character\"), var);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.askpass\")) {\n+\t\tFREE_AND_NULL(askpass_program);\n+\t\treturn git_config_string(&askpass_program, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"core.excludesfile\")) {\n+\t\tFREE_AND_NULL(excludes_file);\n+\t\treturn git_config_pathname(&excludes_file, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"core.whitespace\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\twhitespace_rule_cfg = parse_whitespace_rule(value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.fsync\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\tfsync_components = parse_fsync_components(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.fsyncmethod\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\tif (!strcmp(value, \"fsync\"))\n+\t\t\tfsync_method = FSYNC_METHOD_FSYNC;\n+\t\telse if (!strcmp(value, \"writeout-only\"))\n+\t\t\tfsync_method = FSYNC_METHOD_WRITEOUT_ONLY;\n+\t\telse if (!strcmp(value, \"batch\"))\n+\t\t\tfsync_method = FSYNC_METHOD_BATCH;\n+\t\telse\n+\t\t\twarning(_(\"ignoring unknown core.fsyncMethod value '%s'\"), value);\n+\n+\t}\n+\n+\tif (!strcmp(var, \"core.fsyncobjectfiles\")) {\n+\t\tif (fsync_object_files < 0)\n+\t\t\twarning(_(\"core.fsyncObjectFiles is deprecated; use core.fsync instead\"));\n+\t\tfsync_object_files = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.createobject\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\tif (!strcmp(value, \"rename\"))\n+\t\t\tobject_creation_mode = OBJECT_CREATION_USES_RENAMES;\n+\t\telse if (!strcmp(value, \"link\"))\n+\t\t\tobject_creation_mode = OBJECT_CREATION_USES_HARDLINKS;\n+\t\telse\n+\t\t\tdie(_(\"invalid mode for object creation: %s\"), value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.sparsecheckout\")) {\n+\t\tcore_apply_sparse_checkout = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.sparsecheckoutcone\")) {\n+\t\tcore_sparse_checkout_cone = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.precomposeunicode\")) {\n+\t\tprecomposed_unicode = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.protecthfs\")) {\n+\t\tprotect_hfs = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.protectntfs\")) {\n+\t\tprotect_ntfs = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"core.maxtreedepth\")) {\n+\t\tmax_allowed_tree_depth = git_config_int(var, value, ctx->kvi);\n+\t\treturn 0;\n+\t}\n+\n+\t/* Add other config variables here and to Documentation/config.adoc. */\n+\treturn platform_core_config(var, value, ctx, cb);\n+}\n+\n+static int git_default_sparse_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"sparse.expectfilesoutsideofpatterns\")) {\n+\t\tsparse_expect_files_outside_of_patterns = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\t/* Add other config variables here and to Documentation/config/sparse.adoc. */\n+\treturn 0;\n+}\n+\n+static int git_default_i18n_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"i18n.commitencoding\")) {\n+\t\tFREE_AND_NULL(git_commit_encoding);\n+\t\treturn git_config_string(&git_commit_encoding, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"i18n.logoutputencoding\")) {\n+\t\tFREE_AND_NULL(git_log_output_encoding);\n+\t\treturn git_config_string(&git_log_output_encoding, var, value);\n+\t}\n+\n+\t/* Add other config variables here and to Documentation/config.adoc. */\n+\treturn 0;\n+}\n+\n+static int git_default_branch_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"branch.autosetupmerge\")) {\n+\t\tif (value && !strcmp(value, \"always\")) {\n+\t\t\tgit_branch_track = BRANCH_TRACK_ALWAYS;\n+\t\t\treturn 0;\n+\t\t} else if (value && !strcmp(value, \"inherit\")) {\n+\t\t\tgit_branch_track = BRANCH_TRACK_INHERIT;\n+\t\t\treturn 0;\n+\t\t} else if (value && !strcmp(value, \"simple\")) {\n+\t\t\tgit_branch_track = BRANCH_TRACK_SIMPLE;\n+\t\t\treturn 0;\n+\t\t}\n+\t\tgit_branch_track = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\tif (!strcmp(var, \"branch.autosetuprebase\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\telse if (!strcmp(value, \"never\"))\n+\t\t\tautorebase = AUTOREBASE_NEVER;\n+\t\telse if (!strcmp(value, \"local\"))\n+\t\t\tautorebase = AUTOREBASE_LOCAL;\n+\t\telse if (!strcmp(value, \"remote\"))\n+\t\t\tautorebase = AUTOREBASE_REMOTE;\n+\t\telse if (!strcmp(value, \"always\"))\n+\t\t\tautorebase = AUTOREBASE_ALWAYS;\n+\t\telse\n+\t\t\treturn error(_(\"malformed value for %s\"), var);\n+\t\treturn 0;\n+\t}\n+\n+\t/* Add other config variables here and to Documentation/config.adoc. */\n+\treturn 0;\n+}\n+\n+static int git_default_push_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"push.default\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\telse if (!strcmp(value, \"nothing\"))\n+\t\t\tpush_default = PUSH_DEFAULT_NOTHING;\n+\t\telse if (!strcmp(value, \"matching\"))\n+\t\t\tpush_default = PUSH_DEFAULT_MATCHING;\n+\t\telse if (!strcmp(value, \"simple\"))\n+\t\t\tpush_default = PUSH_DEFAULT_SIMPLE;\n+\t\telse if (!strcmp(value, \"upstream\"))\n+\t\t\tpush_default = PUSH_DEFAULT_UPSTREAM;\n+\t\telse if (!strcmp(value, \"tracking\")) /* deprecated */\n+\t\t\tpush_default = PUSH_DEFAULT_UPSTREAM;\n+\t\telse if (!strcmp(value, \"current\"))\n+\t\t\tpush_default = PUSH_DEFAULT_CURRENT;\n+\t\telse {\n+\t\t\terror(_(\"malformed value for %s: %s\"), var, value);\n+\t\t\treturn error(_(\"must be one of nothing, matching, simple, \"\n+\t\t\t\t       \"upstream or current\"));\n+\t\t}\n+\t\treturn 0;\n+\t}\n+\n+\t/* Add other config variables here and to Documentation/config.adoc. */\n+\treturn 0;\n+}\n+\n+static int git_default_mailmap_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"mailmap.file\")) {\n+\t\tFREE_AND_NULL(git_mailmap_file);\n+\t\treturn git_config_pathname(&git_mailmap_file, var, value);\n+\t}\n+\n+\tif (!strcmp(var, \"mailmap.blob\")) {\n+\t\tFREE_AND_NULL(git_mailmap_blob);\n+\t\treturn git_config_string(&git_mailmap_blob, var, value);\n+\t}\n+\n+\t/* Add other config variables here and to Documentation/config.adoc. */\n+\treturn 0;\n+}\n+\n+static int git_default_attr_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"attr.tree\")) {\n+\t\tFREE_AND_NULL(git_attr_tree);\n+\t\treturn git_config_string(&git_attr_tree, var, value);\n+\t}\n+\n+\t/*\n+\t * Add other attribute related config variables here and to\n+\t * Documentation/config/attr.adoc.\n+\t */\n+\treturn 0;\n+}\n+\n+int git_default_config(const char *var, const char *value,\n+\t\t       const struct config_context *ctx, void *cb)\n+{\n+\tif (starts_with(var, \"core.\"))\n+\t\treturn git_default_core_config(var, value, ctx, cb);\n+\n+\tif (starts_with(var, \"user.\") ||\n+\t    starts_with(var, \"author.\") ||\n+\t    starts_with(var, \"committer.\"))\n+\t\treturn git_ident_config(var, value, ctx, cb);\n+\n+\tif (starts_with(var, \"i18n.\"))\n+\t\treturn git_default_i18n_config(var, value);\n+\n+\tif (starts_with(var, \"branch.\"))\n+\t\treturn git_default_branch_config(var, value);\n+\n+\tif (starts_with(var, \"push.\"))\n+\t\treturn git_default_push_config(var, value);\n+\n+\tif (starts_with(var, \"mailmap.\"))\n+\t\treturn git_default_mailmap_config(var, value);\n+\n+\tif (starts_with(var, \"attr.\"))\n+\t\treturn git_default_attr_config(var, value);\n+\n+\tif (starts_with(var, \"advice.\") || starts_with(var, \"color.advice\"))\n+\t\treturn git_default_advice_config(var, value);\n+\n+\tif (!strcmp(var, \"pager.color\") || !strcmp(var, \"color.pager\")) {\n+\t\tpager_use_color = git_config_bool(var,value);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"pack.packsizelimit\")) {\n+\t\tpack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);\n+\t\treturn 0;\n+\t}\n+\n+\tif (!strcmp(var, \"pack.compression\")) {\n+\t\tint level = git_config_int(var, value, ctx->kvi);\n+\t\tif (level == -1)\n+\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n+\t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n+\t\t\tdie(_(\"bad pack compression level %d\"), level);\n+\t\tpack_compression_level = level;\n+\t\tpack_compression_seen = 1;\n+\t\treturn 0;\n+\t}\n+\n+\tif (starts_with(var, \"sparse.\"))\n+\t\treturn git_default_sparse_config(var, value);\n+\n+\t/* Add other config variables here and to Documentation/config.adoc. */\n+\treturn 0;\n+}\ndiff --git a/environment.h b/environment.h\nindex 3d806ced6e4..8cfce41015b 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -104,6 +104,9 @@ int use_optional_locks(void);\n const char *get_git_namespace(void);\n const char *strip_namespace(const char *namespaced_ref);\n \n+int git_default_config(const char *, const char *,\n+\t\t       const struct config_context *, void *);\n+\n /*\n  * TODO: All the below state either explicitly or implicitly relies on\n  * `the_repository`. We should eventually get rid of these and make the\ndiff --git a/fsck.c b/fsck.c\nindex 23965e1880f..171b424dd57 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -3,6 +3,7 @@\n #include \"git-compat-util.h\"\n #include \"date.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"odb.h\"\n #include \"path.h\"\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 17b9fe4ff8c..1922e23fcd3 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -2,6 +2,7 @@\n \n #include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"http.h\"\ndiff --git a/http.c b/http.c\nindex d94e8f63b57..33ae9429fd8 100644\n--- a/http.c\n+++ b/http.c\n@@ -3,6 +3,7 @@\n \n #include \"git-compat-util.h\"\n #include \"git-curl-compat.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"http.h\"\n #include \"config.h\"\ndiff --git a/imap-send.c b/imap-send.c\nindex 9b26c669c01..254ec83ab78 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -28,6 +28,7 @@\n #include \"advice.h\"\n #include \"config.h\"\n #include \"credential.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\ndiff --git a/mailinfo.c b/mailinfo.c\nindex b4e815b2d8b..99ac596e096 100644\n--- a/mailinfo.c\n+++ b/mailinfo.c\n@@ -2,6 +2,7 @@\n \n #include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex-ll.h\"\n #include \"utf8.h\"\ndiff --git a/reflog.c b/reflog.c\nindex 39c205fd26e..a9740051346 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -3,6 +3,7 @@\n \n #include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"odb.h\"\ndiff --git a/rerere.c b/rerere.c\nindex c7c3e535ce5..6ec55964e2a 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -5,6 +5,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"copy.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/t/helper/test-advise.c b/t/helper/test-advise.c\nindex 77c15a46cfa..81ed93a05c9 100644\n--- a/t/helper/test-advise.c\n+++ b/t/helper/test-advise.c\n@@ -3,6 +3,7 @@\n #include \"test-tool.h\"\n #include \"advice.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"setup.h\"\n \n int cmd__advise_if_enabled(int argc, const char **argv)\ndiff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c\nindex b2da48eda05..9ae71cefb30 100644\n--- a/t/helper/test-read-cache.c\n+++ b/t/helper/test-read-cache.c\n@@ -2,6 +2,7 @@\n \n #include \"test-tool.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"read-cache-ll.h\"\n #include \"repository.h\"\n #include \"setup.h\"\ndiff --git a/xdiff-interface.c b/xdiff-interface.c\nindex 0e5d38c9600..4971f722b3e 100644\n--- a/xdiff-interface.c\n+++ b/xdiff-interface.c\n@@ -2,6 +2,7 @@\n #define DISABLE_SIGN_COMPARE_WARNINGS\n \n #include \"git-compat-util.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"config.h\"\n #include \"hex.h\"\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522568","messageId":"20250723-pks-config-wo-the-repository-v2-21-1502d60d3867@pks.im","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@pks.im","subject":"[PATCH v2 21/21] config: fix sign comparison warnings","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-23T14:08:42Z","receivedAt":"2025-07-23T14:09:37Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"There are a couple of -Wsign-compare warnings in \"config.c\":\n\n  - `prepare_include_condition_pattern()` is returns a signed integer,\n    where it either returns a negative error code or the index of the\n    last dir separator in a path. That index will always be a\n    non-negative number, but we cannot just change the return type to a\n    `size_t` due to it being re-used as error code. This is fixed by\n    splitting up concerns: the return value is only used as error code,\n    and the prefix is now returned via an out-pointer. This fixes a sign\n    comparison warning when comparing `text.len < prefix`,\n\n  - We treat `struct config_store_data::seen` as signed integer in\n    several places even though it's unsigned.\n\n  - There are multiple trivial sign comparison warnings where we use a\n    signed loop index to iterate through an unsigned number of items.\n\nFix all of these issues and drop the `DISABLE_SIGN_COMPARE_WARNINGS`\nmacro.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n config.c | 40 +++++++++++++++++++++-------------------\n 1 file changed, 21 insertions(+), 19 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex 947fba3d8d4..2fe8e52ae2a 100644\n--- a/config.c\n+++ b/config.c\n@@ -6,8 +6,6 @@\n  *\n  */\n \n-#define DISABLE_SIGN_COMPARE_WARNINGS\n-\n #include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"date.h\"\n@@ -198,11 +196,12 @@ static void add_trailing_starstar_for_dir(struct strbuf *pat)\n }\n \n static int prepare_include_condition_pattern(const struct key_value_info *kvi,\n-\t\t\t\t\t     struct strbuf *pat)\n+\t\t\t\t\t     struct strbuf *pat,\n+\t\t\t\t\t     size_t *out)\n {\n \tstruct strbuf path = STRBUF_INIT;\n \tchar *expanded;\n-\tint prefix = 0;\n+\tsize_t prefix = 0;\n \n \texpanded = interpolate_path(pat->buf, 1);\n \tif (expanded) {\n@@ -229,8 +228,10 @@ static int prepare_include_condition_pattern(const struct key_value_info *kvi,\n \n \tadd_trailing_starstar_for_dir(pat);\n \n+\t*out = prefix;\n+\n \tstrbuf_release(&path);\n-\treturn prefix;\n+\treturn 0;\n }\n \n static int include_by_gitdir(const struct key_value_info *kvi,\n@@ -239,7 +240,8 @@ static int include_by_gitdir(const struct key_value_info *kvi,\n {\n \tstruct strbuf text = STRBUF_INIT;\n \tstruct strbuf pattern = STRBUF_INIT;\n-\tint ret = 0, prefix;\n+\tsize_t prefix;\n+\tint ret = 0;\n \tconst char *git_dir;\n \tint already_tried_absolute = 0;\n \n@@ -250,12 +252,11 @@ static int include_by_gitdir(const struct key_value_info *kvi,\n \n \tstrbuf_realpath(&text, git_dir, 1);\n \tstrbuf_add(&pattern, cond, cond_len);\n-\tprefix = prepare_include_condition_pattern(kvi, &pattern);\n-\n-again:\n-\tif (prefix < 0)\n+\tret = prepare_include_condition_pattern(kvi, &pattern, &prefix);\n+\tif (ret < 0)\n \t\tgoto done;\n \n+again:\n \tif (prefix > 0) {\n \t\t/*\n \t\t * perform literal matching on the prefix part so that\n@@ -724,7 +725,6 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n \tif (env) {\n \t\tunsigned long count;\n \t\tchar *endp;\n-\t\tint i;\n \n \t\tcount = strtoul(env, &endp, 10);\n \t\tif (*endp) {\n@@ -736,10 +736,10 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n \t\t\tgoto out;\n \t\t}\n \n-\t\tfor (i = 0; i < count; i++) {\n+\t\tfor (unsigned long i = 0; i < count; i++) {\n \t\t\tconst char *key, *value;\n \n-\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_KEY_%d\", i);\n+\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_KEY_%lu\", i);\n \t\t\tkey = getenv_safe(&to_free, envvar.buf);\n \t\t\tif (!key) {\n \t\t\t\tret = error(_(\"missing config key %s\"), envvar.buf);\n@@ -747,7 +747,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n \t\t\t}\n \t\t\tstrbuf_reset(&envvar);\n \n-\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_VALUE_%d\", i);\n+\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_VALUE_%lu\", i);\n \t\t\tvalue = getenv_safe(&to_free, envvar.buf);\n \t\t\tif (!value) {\n \t\t\t\tret = error(_(\"missing config value %s\"), envvar.buf);\n@@ -1614,13 +1614,13 @@ int config_with_options(config_fn_t fn, void *data,\n \n static void configset_iter(struct config_set *set, config_fn_t fn, void *data)\n {\n-\tint i, value_index;\n+\tint value_index;\n \tstruct string_list *values;\n \tstruct config_set_element *entry;\n \tstruct configset_list *list = &set->list;\n \tstruct config_context ctx = CONFIG_CONTEXT_INIT;\n \n-\tfor (i = 0; i < list->nr; i++) {\n+\tfor (size_t i = 0; i < list->nr; i++) {\n \t\tentry = list->items[i].e;\n \t\tvalue_index = list->items[i].value_index;\n \t\tvalues = &entry->value_list;\n@@ -2470,10 +2470,11 @@ static ssize_t write_pair(int fd, const char *key, const char *value,\n  */\n static void maybe_remove_section(struct config_store_data *store,\n \t\t\t\t size_t *begin_offset, size_t *end_offset,\n-\t\t\t\t int *seen_ptr)\n+\t\t\t\t unsigned *seen_ptr)\n {\n \tsize_t begin;\n-\tint i, seen, section_seen = 0;\n+\tint section_seen = 0;\n+\tunsigned int i, seen;\n \n \t/*\n \t * First, ensure that this is the first key, and that there are no\n@@ -2716,7 +2717,8 @@ int repo_config_set_multivar_in_file_gently(struct repository *r,\n \t} else {\n \t\tstruct stat st;\n \t\tsize_t copy_begin, copy_end;\n-\t\tint i, new_line = 0;\n+\t\tunsigned i;\n+\t\tint new_line = 0;\n \t\tstruct config_options opts;\n \n \t\tif (!value_pattern)\n\n-- \n2.50.1.552.g942d659e1b.dirty\n\n"},{"id":"522569","messageId":"4ea2b50c-7277-432b-bcb6-912a0cbcb261@gmail.com","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-21-1502d60d3867@pks.im","subject":"Re: [PATCH v2 21/21] config: fix sign comparison warnings","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-23T14:48:37Z","receivedAt":"2025-07-23T14:48:40Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 23/07/2025 15:08, Patrick Steinhardt wrote:\n> There are a couple of -Wsign-compare warnings in \"config.c\":\n> \n>    - `prepare_include_condition_pattern()` is returns a signed integer,\n>      where it either returns a negative error code or the index of the\n>      last dir separator in a path. That index will always be a\n>      non-negative number, but we cannot just change the return type to a\n>      `size_t` due to it being re-used as error code. This is fixed by\n>      splitting up concerns: the return value is only used as error code,\n>      and the prefix is now returned via an out-pointer. This fixes a sign\n>      comparison warning when comparing `text.len < prefix`,\n> \n\nSounds good, let's see how the caller is affected ...\n\n> @@ -239,7 +240,8 @@ static int include_by_gitdir(const struct key_value_info *kvi,\n>   {\n>   \tstruct strbuf text = STRBUF_INIT;\n>   \tstruct strbuf pattern = STRBUF_INIT;\n> -\tint ret = 0, prefix;\n> +\tsize_t prefix;\n> +\tint ret = 0;\n>   \tconst char *git_dir;\n>   \tint already_tried_absolute = 0;\n>   \n> @@ -250,12 +252,11 @@ static int include_by_gitdir(const struct key_value_info *kvi,\n>   \n>   \tstrbuf_realpath(&text, git_dir, 1);\n>   \tstrbuf_add(&pattern, cond, cond_len);\n> -\tprefix = prepare_include_condition_pattern(kvi, &pattern);\n> -\n> -again:\n> -\tif (prefix < 0)\n> +\tret = prepare_include_condition_pattern(kvi, &pattern, &prefix);\n> +\tif (ret < 0)\n>   \t\tgoto done;\n>   \n> +again:\nprefix is not modified below this point so moving the label down below \nthe error check is safe.\n\nThis looks good, thanks\n\nPhillip\n\n>   \tif (prefix > 0) {\n>   \t\t/*\n>   \t\t * perform literal matching on the prefix part so that\n> @@ -724,7 +725,6 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n>   \tif (env) {\n>   \t\tunsigned long count;\n>   \t\tchar *endp;\n> -\t\tint i;\n>   \n>   \t\tcount = strtoul(env, &endp, 10);\n>   \t\tif (*endp) {\n> @@ -736,10 +736,10 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n>   \t\t\tgoto out;\n>   \t\t}\n>   \n> -\t\tfor (i = 0; i < count; i++) {\n> +\t\tfor (unsigned long i = 0; i < count; i++) {\n>   \t\t\tconst char *key, *value;\n>   \n> -\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_KEY_%d\", i);\n> +\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_KEY_%lu\", i);\n>   \t\t\tkey = getenv_safe(&to_free, envvar.buf);\n>   \t\t\tif (!key) {\n>   \t\t\t\tret = error(_(\"missing config key %s\"), envvar.buf);\n> @@ -747,7 +747,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n>   \t\t\t}\n>   \t\t\tstrbuf_reset(&envvar);\n>   \n> -\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_VALUE_%d\", i);\n> +\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_VALUE_%lu\", i);\n>   \t\t\tvalue = getenv_safe(&to_free, envvar.buf);\n>   \t\t\tif (!value) {\n>   \t\t\t\tret = error(_(\"missing config value %s\"), envvar.buf);\n> @@ -1614,13 +1614,13 @@ int config_with_options(config_fn_t fn, void *data,\n>   \n>   static void configset_iter(struct config_set *set, config_fn_t fn, void *data)\n>   {\n> -\tint i, value_index;\n> +\tint value_index;\n>   \tstruct string_list *values;\n>   \tstruct config_set_element *entry;\n>   \tstruct configset_list *list = &set->list;\n>   \tstruct config_context ctx = CONFIG_CONTEXT_INIT;\n>   \n> -\tfor (i = 0; i < list->nr; i++) {\n> +\tfor (size_t i = 0; i < list->nr; i++) {\n>   \t\tentry = list->items[i].e;\n>   \t\tvalue_index = list->items[i].value_index;\n>   \t\tvalues = &entry->value_list;\n> @@ -2470,10 +2470,11 @@ static ssize_t write_pair(int fd, const char *key, const char *value,\n>    */\n>   static void maybe_remove_section(struct config_store_data *store,\n>   \t\t\t\t size_t *begin_offset, size_t *end_offset,\n> -\t\t\t\t int *seen_ptr)\n> +\t\t\t\t unsigned *seen_ptr)\n>   {\n>   \tsize_t begin;\n> -\tint i, seen, section_seen = 0;\n> +\tint section_seen = 0;\n> +\tunsigned int i, seen;\n>   \n>   \t/*\n>   \t * First, ensure that this is the first key, and that there are no\n> @@ -2716,7 +2717,8 @@ int repo_config_set_multivar_in_file_gently(struct repository *r,\n>   \t} else {\n>   \t\tstruct stat st;\n>   \t\tsize_t copy_begin, copy_end;\n> -\t\tint i, new_line = 0;\n> +\t\tunsigned i;\n> +\t\tint new_line = 0;\n>   \t\tstruct config_options opts;\n>   \n>   \t\tif (!value_pattern)\n> \n\n"},{"id":"522572","messageId":"xmqqfrenori2.fsf@gitster.g","threadId":"63803","inReplyTo":"20250723-pks-config-wo-the-repository-v2-21-1502d60d3867@pks.im","subject":"Re: [PATCH v2 21/21] config: fix sign comparison warnings","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-23T15:29:09Z","receivedAt":"2025-07-23T15:29:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n>  static int prepare_include_condition_pattern(const struct key_value_info *kvi,\n> -\t\t\t\t\t     struct strbuf *pat)\n> +\t\t\t\t\t     struct strbuf *pat,\n> +\t\t\t\t\t     size_t *out)\n>  {\n>  \tstruct strbuf path = STRBUF_INIT;\n>  \tchar *expanded;\n> -\tint prefix = 0;\n> +\tsize_t prefix = 0;\n>  \n>  \texpanded = interpolate_path(pat->buf, 1);\n>  \tif (expanded) {\n> @@ -229,8 +228,10 @@ static int prepare_include_condition_pattern(const struct key_value_info *kvi,\n>  \n>  \tadd_trailing_starstar_for_dir(pat);\n>  \n> +\t*out = prefix;\n> +\n>  \tstrbuf_release(&path);\n> -\treturn prefix;\n> +\treturn 0;\n>  }\n\nOK, so unlike the previous attempt, this one uses an out parameter\nto return the length of the prefix it counted, so the caller should\nuse its return value solely for noticing an error.\n\nThe first iteration would have given the caller (size_t)-1 and the\n\"ah, we got a non-zero prefix, let's see if it matches the string we\nhave\" code that follows in the caller safely jumps to the \"done\"\nlabel without doing any harm, so in that sense, the breakage there\nwas also merely theoretical ;-), but this certainly is more correct.\n\n> @@ -239,7 +240,8 @@ static int include_by_gitdir(const struct key_value_info *kvi,\n>  {\n>  \tstruct strbuf text = STRBUF_INIT;\n>  \tstruct strbuf pattern = STRBUF_INIT;\n> -\tint ret = 0, prefix;\n> +\tsize_t prefix;\n> +\tint ret = 0;\n\nAnd this is how the caller adjusts to the calling convention.\n\n>  \tconst char *git_dir;\n>  \tint already_tried_absolute = 0;\n>  \n> @@ -250,12 +252,11 @@ static int include_by_gitdir(const struct key_value_info *kvi,\n>  \n>  \tstrbuf_realpath(&text, git_dir, 1);\n>  \tstrbuf_add(&pattern, cond, cond_len);\n> -\tprefix = prepare_include_condition_pattern(kvi, &pattern);\n> -\n> -again:\n> -\tif (prefix < 0)\n> +\tret = prepare_include_condition_pattern(kvi, &pattern, &prefix);\n> +\tif (ret < 0)\n>  \t\tgoto done;\n\nSame.  Negative return value is checked for early return upon an\nerror, and the value we received in prefix is used as before.\n\n>  \tif (env) {\n>  \t\tunsigned long count;\n>  \t\tchar *endp;\n> -\t\tint i;\n>  \n>  \t\tcount = strtoul(env, &endp, 10);\n>  \t\tif (*endp) {\n> @@ -736,10 +736,10 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n>  \t\t\tgoto out;\n>  \t\t}\n>  \n> -\t\tfor (i = 0; i < count; i++) {\n> +\t\tfor (unsigned long i = 0; i < count; i++) {\n>  \t\t\tconst char *key, *value;\n\nVariable \"i\" of type ul looks confusing, but it is a counter to\ncount up to \"cout\" that is a result from strtoul(), so everything is\nnow consistent.  Good.\n\nNot that we would seriously expect that we can export more than 2\nbillion environment variables sensibly, so this is all theoretical\nexercise ;-)\n\n> -\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_KEY_%d\", i);\n> +\t\t\tstrbuf_addf(&envvar, \"GIT_CONFIG_KEY_%lu\", i);\n\nGood.\n\n> @@ -2470,10 +2470,11 @@ static ssize_t write_pair(int fd, const char *key, const char *value,\n>   */\n>  static void maybe_remove_section(struct config_store_data *store,\n>  \t\t\t\t size_t *begin_offset, size_t *end_offset,\n> -\t\t\t\t int *seen_ptr)\n> +\t\t\t\t unsigned *seen_ptr)\n>  {\n>  \tsize_t begin;\n> -\tint i, seen, section_seen = 0;\n> +\tint section_seen = 0;\n> +\tunsigned int i, seen;\n>  \n>  \t/*\n>  \t * First, ensure that this is the first key, and that there are no\n\nThe loop in the body of this function makes references to an array\nwith the index (i-1), but i counts downwards and never reaches 0, so\nthis should be OK.  The next hunk is a change that adjust the caller\nto this change.\n\n> @@ -2716,7 +2717,8 @@ int repo_config_set_multivar_in_file_gently(struct repository *r,\n>  \t} else {\n>  \t\tstruct stat st;\n>  \t\tsize_t copy_begin, copy_end;\n> -\t\tint i, new_line = 0;\n> +\t\tunsigned i;\n> +\t\tint new_line = 0;\n>  \t\tstruct config_options opts;\n>  \n>  \t\tif (!value_pattern)\n\nLooks good.  Thanks.\n"}]}