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_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>
static void git_apply_config(void)
{
- git_config_get_string("apply.whitespace", &apply_default_whitespace);
- git_config_get_string("apply.ignorewhitespace", &apply_default_ignorewhitespace);
+ repo_config_get_string(the_repository, "apply.whitespace", &apply_default_whitespace);
+ repo_config_get_string(the_repository, "apply.ignorewhitespace", &apply_default_ignorewhitespace);
repo_config(the_repository, git_xmerge_config, NULL);
}
char *v = NULL;
struct strbuf name = STRBUF_INIT;
strbuf_addf(&name, "branch.%s.description", branch_name);
- if (git_config_get_string(name.buf, &v)) {
+ if (repo_config_get_string(the_repository, name.buf, &v)) {
strbuf_release(&name);
return -1;
}
if (!git_config_get_ulong("core.deltabasecachelimit", &ulongval))
cfg->delta_base_cache_limit = ulongval;
- if (!git_config_get_string("gc.repackfilter", &owned)) {
+ if (!repo_config_get_string(the_repository, "gc.repackfilter", &owned)) {
free(cfg->repack_filter);
cfg->repack_filter = owned;
}
- if (!git_config_get_string("gc.repackfilterto", &owned)) {
+ if (!repo_config_get_string(the_repository, "gc.repackfilterto", &owned)) {
free(cfg->repack_filter_to);
cfg->repack_filter_to = owned;
}
* since the command-line takes precedent.
*/
if (use_default_decoration_filter &&
- !git_config_get_string("log.initialdecorationset", &value) &&
+ !repo_config_get_string(the_repository, "log.initialdecorationset", &value) &&
!strcmp("all", value))
use_default_decoration_filter = 0;
free(value);
{
char *value;
- if (git_config_get_string(key, &value))
+ if (repo_config_get_string(the_repository, key, &value))
return 1;
if (parse_notes_merge_strategy(value, strategy))
git_die_config(the_repository, key, _("unknown notes merge strategy %s"), value);
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 "
* .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);
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");
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);
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_string(const char *key, char **dest)
-{
- return repo_config_get_string(the_repository, key, dest);
-}
-
static inline int git_config_get_string_tmp(const char *key, const char **dest)
{
return repo_config_get_string_tmp(the_repository, key, dest);
if (!uri_protocols.nr) {
char *str;
- if (!git_config_get_string("fetch.uriprotocols", &str) && str) {
+ if (!repo_config_get_string(the_repository, "fetch.uriprotocols", &str) && str) {
string_list_split(&uri_protocols, str, ',', -1);
free(str);
}
git_config_get_int("merge.renamelimit", &opt->rename_limit);
git_config_get_bool("merge.renormalize", &renormalize);
opt->renormalize = renormalize;
- if (!git_config_get_string("diff.renames", &value)) {
+ if (!repo_config_get_string(the_repository, "diff.renames", &value)) {
opt->detect_renames = git_config_rename("diff.renames", value);
free(value);
}
- if (!git_config_get_string("merge.renames", &value)) {
+ if (!repo_config_get_string(the_repository, "merge.renames", &value)) {
opt->detect_renames = git_config_rename("merge.renames", value);
free(value);
}
- if (!git_config_get_string("merge.directoryrenames", &value)) {
+ if (!repo_config_get_string(the_repository, "merge.directoryrenames", &value)) {
int boolval = git_parse_maybe_bool(value);
if (0 <= boolval) {
opt->detect_directory_renames = boolval ?
free(value);
}
if (ui) {
- if (!git_config_get_string("diff.algorithm", &value)) {
+ if (!repo_config_get_string(the_repository, "diff.algorithm", &value)) {
long diff_algorithm = parse_algorithm_value(value);
if (diff_algorithm < 0)
die(_("unknown value for config '%s': %s"), "diff.algorithm", value);
int res;
if ((reconfigure && config->overwrite_on_reconfigure) ||
- git_config_get_string(config->key, &value)) {
+ repo_config_get_string(the_repository, config->key, &value)) {
trace2_data_string("scalar", the_repository, config->key, "created");
res = git_config_set_gently(config->key, config->value);
} else {
* The `log.excludeDecoration` setting is special because it allows
* for multiple values.
*/
- if (git_config_get_string("log.excludeDecoration", &value)) {
+ if (repo_config_get_string(the_repository, "log.excludeDecoration", &value)) {
trace2_data_string("scalar", the_repository,
"log.excludeDecoration", "created");
if (git_config_set_multivar_gently("log.excludeDecoration",
revs.topo_order = 1;
revs.pretty_given = 1;
- git_config_get_string("rebase.instructionFormat", &format);
+ repo_config_get_string(the_repository, "rebase.instructionFormat", &format);
if (!format || !*format) {
free(format);
format = xstrdup("# %s");
return 0;
initialized = 1;
- if (!git_config_get_string(key, &value))
+ if (!repo_config_get_string(the_repository, key, &value))
transport_use_color = git_config_colorbool(key, value);
if (!want_color_stderr(transport_use_color))
return 0;
for (size_t i = 0; i < ARRAY_SIZE(keys); i++)
- if (!git_config_get_string(keys[i], &value)) {
+ if (!repo_config_get_string(the_repository, keys[i], &value)) {
if (!value)
return config_error_nonbool(keys[i]);
if (color_parse(value, transport_colors[i]) < 0)
char *value;
/* first check the per-protocol config */
- if (!git_config_get_string(key, &value)) {
+ if (!repo_config_get_string(the_repository, key, &value)) {
enum protocol_allow_config ret =
parse_protocol_config(key, value);
free(key);
free(key);
/* if defined, fallback to user-defined default for unknown protocols */
- if (!git_config_get_string("protocol.allow", &value)) {
+ if (!repo_config_get_string(the_repository, "protocol.allow", &value)) {
enum protocol_allow_config ret =
parse_protocol_config("protocol.allow", value);
free(value);