Git fork

config: drop `git_config_get_multivar_gently()` 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_get_multivar_gently()`. All callsites are adjusted so that
they use `repo_config_get_multivar_gently(the_repository, ...)` instead.
While some callsites might already have a repository available, this
mechanical conversion is the exact same as the current situation and
thus cannot cause any regression. Those sites should eventually be
cleaned up in a later patch series.

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

authored by

Patrick Steinhardt and committed by
Junio C Hamano
1bb3e410 adf9e5f8

+10 -17
+1 -1
branch.c
··· 130 if (repo_config_set_gently(the_repository, key.buf, NULL) < 0) 131 goto out_err; 132 for_each_string_list_item(item, remotes) 133 - if (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0) 134 goto out_err; 135 136 if (rebasing) {
··· 130 if (repo_config_set_gently(the_repository, key.buf, NULL) < 0) 131 goto out_err; 132 for_each_string_list_item(item, remotes) 133 + if (repo_config_set_multivar_gently(the_repository, key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0) 134 goto out_err; 135 136 if (rebasing) {
+4 -4
builtin/clone.c
··· 762 { 763 /* 764 * give git_clone_config a chance to write config values back to the 765 - * environment, since git_config_set_multivar_gently only deals with 766 * config-file writes 767 */ 768 int apply_failed = git_clone_config(key, value, ctx, data); 769 if (apply_failed) 770 return apply_failed; 771 772 - return git_config_set_multivar_gently(key, 773 - value ? value : "true", 774 - CONFIG_REGEX_NONE, 0); 775 } 776 777 static void write_config(struct string_list *config)
··· 762 { 763 /* 764 * give git_clone_config a chance to write config values back to the 765 + * environment, since repo_config_set_multivar_gently only deals with 766 * config-file writes 767 */ 768 int apply_failed = git_clone_config(key, value, ctx, data); 769 if (apply_failed) 770 return apply_failed; 771 772 + return repo_config_set_multivar_gently(the_repository, key, 773 + value ? value : "true", 774 + CONFIG_REGEX_NONE, 0); 775 } 776 777 static void write_config(struct string_list *config)
+2 -2
builtin/remote.c
··· 1633 1634 static int remove_all_fetch_refspecs(const char *key) 1635 { 1636 - return git_config_set_multivar_gently(key, NULL, NULL, 1637 - CONFIG_FLAGS_MULTI_REPLACE); 1638 } 1639 1640 static void add_branches(struct remote *remote, const char **branches,
··· 1633 1634 static int remove_all_fetch_refspecs(const char *key) 1635 { 1636 + return repo_config_set_multivar_gently(the_repository, key, NULL, NULL, 1637 + CONFIG_FLAGS_MULTI_REPLACE); 1638 } 1639 1640 static void add_branches(struct remote *remote, const char **branches,
-7
config.h
··· 745 key, value, value_pattern, flags); 746 } 747 748 - static inline int git_config_set_multivar_gently(const char *key, const char *value, 749 - const char *value_pattern, unsigned flags) 750 - { 751 - return repo_config_set_multivar_gently(the_repository, key, value, 752 - value_pattern, flags); 753 - } 754 - 755 static inline void git_config_set_multivar(const char *key, const char *value, 756 const char *value_pattern, unsigned flags) 757 {
··· 745 key, value, value_pattern, flags); 746 } 747 748 static inline void git_config_set_multivar(const char *key, const char *value, 749 const char *value_pattern, unsigned flags) 750 {
+3 -3
scalar.c
··· 196 if (repo_config_get_string(the_repository, "log.excludeDecoration", &value)) { 197 trace2_data_string("scalar", the_repository, 198 "log.excludeDecoration", "created"); 199 - if (git_config_set_multivar_gently("log.excludeDecoration", 200 - "refs/prefetch/*", 201 - CONFIG_REGEX_NONE, 0)) 202 return error(_("could not configure " 203 "log.excludeDecoration")); 204 } else {
··· 196 if (repo_config_get_string(the_repository, "log.excludeDecoration", &value)) { 197 trace2_data_string("scalar", the_repository, 198 "log.excludeDecoration", "created"); 199 + if (repo_config_set_multivar_gently(the_repository, "log.excludeDecoration", 200 + "refs/prefetch/*", 201 + CONFIG_REGEX_NONE, 0)) 202 return error(_("could not configure " 203 "log.excludeDecoration")); 204 } else {