config: convert multi_replace to flags
We will extend the flexibility of the config API. Before doing so, let's take an existing 'int multi_replace' parameter and replace it with a new 'unsigned flags' parameter that can take multiple options as a bit field. Update all callers that specified multi_replace to now specify the CONFIG_FLAGS_MULTI_REPLACE flag. To add more clarity, extend the documentation of git_config_set_multivar_in_file() including a clear labeling of its arguments. Other config API methods in config.h require only a change of the final parameter from 'int' to 'unsigned'. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
faefdd61ec
commit
504ee1290e
@ -712,7 +712,7 @@ static int mv(int argc, const char **argv)
|
||||
|
||||
strbuf_reset(&buf);
|
||||
strbuf_addf(&buf, "remote.%s.fetch", rename.new_name);
|
||||
git_config_set_multivar(buf.buf, NULL, NULL, 1);
|
||||
git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
|
||||
strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old_name);
|
||||
for (i = 0; i < oldremote->fetch.raw_nr; i++) {
|
||||
char *ptr;
|
||||
@ -1491,7 +1491,8 @@ static int update(int argc, const char **argv)
|
||||
|
||||
static int remove_all_fetch_refspecs(const char *key)
|
||||
{
|
||||
return git_config_set_multivar_gently(key, NULL, NULL, 1);
|
||||
return git_config_set_multivar_gently(key, NULL, NULL,
|
||||
CONFIG_FLAGS_MULTI_REPLACE);
|
||||
}
|
||||
|
||||
static void add_branches(struct remote *remote, const char **branches,
|
||||
@ -1686,7 +1687,8 @@ static int set_url(int argc, const char **argv)
|
||||
if (!delete_mode)
|
||||
git_config_set_multivar(name_buf.buf, newurl, oldurl, 0);
|
||||
else
|
||||
git_config_set_multivar(name_buf.buf, NULL, oldurl, 1);
|
||||
git_config_set_multivar(name_buf.buf, NULL, oldurl,
|
||||
CONFIG_FLAGS_MULTI_REPLACE);
|
||||
out:
|
||||
strbuf_release(&name_buf);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user