Git fork

config: drop `git_config_set_in_file()` wrapper

In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.

Follow through with that intent and remove `git_config_set_in_file()`.
All callsites are adjusted so that they use
`repo_config_set_in_file(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
122e38c9 5d215a7b

+7 -13
+5 -5
builtin/submodule--helper.c
··· 1810 1810 /* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */ 1811 1811 repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate); 1812 1812 if (sm_alternate) 1813 - git_config_set_in_file(p, "submodule.alternateLocation", 1814 - sm_alternate); 1813 + repo_config_set_in_file(the_repository, p, "submodule.alternateLocation", 1814 + sm_alternate); 1815 1815 repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy); 1816 1816 if (error_strategy) 1817 - git_config_set_in_file(p, "submodule.alternateErrorStrategy", 1818 - error_strategy); 1817 + repo_config_set_in_file(the_repository, p, "submodule.alternateErrorStrategy", 1818 + error_strategy); 1819 1819 1820 1820 free(sm_alternate); 1821 1821 free(error_strategy); ··· 2522 2522 abs_path = absolute_pathdup(path); 2523 2523 rel_path = relative_path(abs_path, subrepo.gitdir, &sb); 2524 2524 2525 - git_config_set_in_file(cfg_file, "core.worktree", rel_path); 2525 + repo_config_set_in_file(the_repository, cfg_file, "core.worktree", rel_path); 2526 2526 2527 2527 free(cfg_file); 2528 2528 free(abs_path);
-6
config.h
··· 734 734 return repo_config_get_pathname(the_repository, key, dest); 735 735 } 736 736 737 - static inline void git_config_set_in_file(const char *config_filename, 738 - const char *key, const char *value) 739 - { 740 - repo_config_set_in_file(the_repository, config_filename, key, value); 741 - } 742 - 743 737 static inline int git_config_set_gently(const char *key, const char *value) 744 738 { 745 739 return repo_config_set_gently(the_repository, key, value);
+2 -2
dir.c
··· 4091 4091 write_file(gitfile_sb.buf, "gitdir: %s", 4092 4092 relative_path(git_dir, work_tree, &rel_path)); 4093 4093 /* Update core.worktree setting */ 4094 - git_config_set_in_file(cfg_sb.buf, "core.worktree", 4095 - relative_path(work_tree, git_dir, &rel_path)); 4094 + repo_config_set_in_file(the_repository, cfg_sb.buf, "core.worktree", 4095 + relative_path(work_tree, git_dir, &rel_path)); 4096 4096 4097 4097 strbuf_release(&gitfile_sb); 4098 4098 strbuf_release(&cfg_sb);