argv[0], value, value_pattern,
comment, flags);
} else {
- ret = git_config_set_in_file_gently(location_opts.source.file,
- argv[0], comment, value);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], comment, value);
if (ret == CONFIG_NOTHING_SET)
error(_("cannot overwrite multiple values with a single value\n"
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
argv[0], NULL, value_pattern,
NULL, flags);
else
- ret = git_config_set_in_file_gently(location_opts.source.file, argv[0],
- NULL, NULL);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0],
+ NULL, NULL);
location_options_release(&location_opts);
return ret;
check_write(&location_opts.source);
check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
- ret = git_config_set_in_file_gently(location_opts.source.file, argv[0], comment, value);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0], comment, value);
if (ret == CONFIG_NOTHING_SET)
error(_("cannot overwrite multiple values with a single value\n"
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
argv[0], NULL, argv[1],
NULL, flags);
else
- ret = git_config_set_in_file_gently(location_opts.source.file,
- argv[0], NULL, NULL);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], NULL, NULL);
}
else if (actions == ACTION_UNSET_ALL) {
check_write(&location_opts.source);
submodule_to_gitdir(the_repository, &sb, path);
strbuf_addstr(&sb, "/config");
- if (git_config_set_in_file_gently(sb.buf, remote_key, NULL, sub_origin_url))
+ if (repo_config_set_in_file_gently(the_repository, sb.buf, remote_key, NULL, sub_origin_url))
die(_("failed to update remote for submodule '%s'"),
path);
error(_("failed to unset '%s' in '%s'"),
"core.bare", to_file);
if (!git_configset_get(&cs, "core.worktree") &&
- git_config_set_in_file_gently(to_file,
- "core.worktree", NULL, NULL))
+ repo_config_set_in_file_gently(the_repository, to_file,
+ "core.worktree", NULL, NULL))
error(_("failed to unset '%s' in '%s'"),
"core.worktree", to_file);
return repo_config_get_pathname(the_repository, key, dest);
}
-static inline int git_config_set_in_file_gently(
- const char *config_filename,
- const char *key,
- const char *comment,
- const char *value)
-{
- return repo_config_set_in_file_gently(the_repository, config_filename,
- key, comment, value);
-}
-
static inline int git_config_set_multivar_in_file_gently(
const char *config_filename,
const char *key, const char *value,
int res = 0;
if (opts->no_commit)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.no-commit", NULL, "true");
if (opts->edit >= 0)
- res |= git_config_set_in_file_gently(opts_file, "options.edit", NULL,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file, "options.edit", NULL,
opts->edit ? "true" : "false");
if (opts->allow_empty)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.allow-empty", NULL, "true");
if (opts->allow_empty_message)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.allow-empty-message", NULL, "true");
if (opts->drop_redundant_commits)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.drop-redundant-commits", NULL, "true");
if (opts->keep_redundant_commits)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.keep-redundant-commits", NULL, "true");
if (opts->signoff)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.signoff", NULL, "true");
if (opts->record_origin)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.record-origin", NULL, "true");
if (opts->allow_ff)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.allow-ff", NULL, "true");
if (opts->mainline) {
struct strbuf buf = STRBUF_INIT;
strbuf_addf(&buf, "%d", opts->mainline);
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.mainline", NULL, buf.buf);
strbuf_release(&buf);
}
if (opts->strategy)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.strategy", NULL, opts->strategy);
if (opts->gpg_sign)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.gpg-sign", NULL, opts->gpg_sign);
for (size_t i = 0; i < opts->xopts.nr; i++)
res |= git_config_set_multivar_in_file_gently(opts_file,
"options.strategy-option",
opts->xopts.v[i], "^$", NULL, 0);
if (opts->allow_rerere_auto)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.allow-rerere-auto", NULL,
opts->allow_rerere_auto == RERERE_AUTOUPDATE ?
"true" : "false");
if (opts->explicit_cleanup)
- res |= git_config_set_in_file_gently(opts_file,
+ res |= repo_config_set_in_file_gently(the_repository, opts_file,
"options.default-msg-cleanup", NULL,
describe_cleanup_mode(opts->default_msg_cleanup));
return res;
{
int ret;
- ret = git_config_set_in_file_gently(GITMODULES_FILE, key, NULL, value);
+ ret = repo_config_set_in_file_gently(the_repository, GITMODULES_FILE, key, NULL, value);
if (ret < 0)
/* Maybe the user already did that, don't error out here */
warning(_("Could not update .gitmodules entry %s"), key);
submodule_name_to_gitdir(&config_path, the_repository, sub->name);
strbuf_addstr(&config_path, "/config");
- if (git_config_set_in_file_gently(config_path.buf, "core.worktree", NULL, NULL))
+ if (repo_config_set_in_file_gently(the_repository, config_path.buf, "core.worktree", NULL, NULL))
warning(_("Could not unset core.worktree setting in submodule '%s'"),
sub->path);
static int move_config_setting(const char *key, const char *value,
const char *from_file, const char *to_file)
{
- if (git_config_set_in_file_gently(to_file, key, NULL, value))
+ if (repo_config_set_in_file_gently(the_repository, to_file, key, NULL, value))
return error(_("unable to set %s in '%s'"), key, to_file);
- if (git_config_set_in_file_gently(from_file, key, NULL, NULL))
+ if (repo_config_set_in_file_gently(the_repository, from_file, key, NULL, NULL))
return error(_("unable to unset %s in '%s'"), key, from_file);
return 0;
}