mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
config: drop git_config_get_string() wrapper
In 036876a106 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.
Follow through with that intent and remove `git_config_get_string()`.
All callsites are adjusted so that they use
`repo_config_get_string(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
4f5ba823b8
commit
627d08cca7
@@ -53,7 +53,7 @@ static char *resolve_relative_url(const char *rel_url, const char *up_path, int
|
||||
struct strbuf remotesb = STRBUF_INIT;
|
||||
|
||||
strbuf_addf(&remotesb, "remote.%s.url", remote);
|
||||
if (git_config_get_string(remotesb.buf, &remoteurl)) {
|
||||
if (repo_config_get_string(the_repository, remotesb.buf, &remoteurl)) {
|
||||
if (!quiet)
|
||||
warning(_("could not look up configuration '%s'. "
|
||||
"Assuming this repository is its own "
|
||||
@@ -468,7 +468,7 @@ static void init_submodule(const char *path, const char *prefix,
|
||||
* .gitmodules, so look it up directly.
|
||||
*/
|
||||
strbuf_addf(&sb, "submodule.%s.url", sub->name);
|
||||
if (git_config_get_string(sb.buf, &url)) {
|
||||
if (repo_config_get_string(the_repository, sb.buf, &url)) {
|
||||
if (!sub->url)
|
||||
die(_("No url found for submodule path '%s' in .gitmodules"),
|
||||
displaypath);
|
||||
@@ -1623,11 +1623,11 @@ static void prepare_possible_alternates(const char *sm_name,
|
||||
char *sm_alternate = NULL, *error_strategy = NULL;
|
||||
struct submodule_alternate_setup sas = SUBMODULE_ALTERNATE_SETUP_INIT;
|
||||
|
||||
git_config_get_string("submodule.alternateLocation", &sm_alternate);
|
||||
repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate);
|
||||
if (!sm_alternate)
|
||||
return;
|
||||
|
||||
git_config_get_string("submodule.alternateErrorStrategy", &error_strategy);
|
||||
repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy);
|
||||
|
||||
if (!error_strategy)
|
||||
error_strategy = xstrdup("die");
|
||||
@@ -1808,11 +1808,11 @@ static int clone_submodule(const struct module_clone_data *clone_data,
|
||||
die(_("could not get submodule directory for '%s'"), clone_data_path);
|
||||
|
||||
/* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */
|
||||
git_config_get_string("submodule.alternateLocation", &sm_alternate);
|
||||
repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate);
|
||||
if (sm_alternate)
|
||||
git_config_set_in_file(p, "submodule.alternateLocation",
|
||||
sm_alternate);
|
||||
git_config_get_string("submodule.alternateErrorStrategy", &error_strategy);
|
||||
repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy);
|
||||
if (error_strategy)
|
||||
git_config_set_in_file(p, "submodule.alternateErrorStrategy",
|
||||
error_strategy);
|
||||
|
||||
Reference in New Issue
Block a user