зеркало из https://github.com/microsoft/git.git
config: rename git_config_set_or_die to git_config_set
Rename git_config_set_or_die functions to git_config_set, leading to the new default behavior of dying whenever a configuration error occurs. By now all callers that shall die on error have been transitioned to the _or_die variants, thus making this patch a simple rename of the functions. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
30598ad06f
Коммит
3d1806487a
|
@ -594,7 +594,7 @@ static int edit_branch_description(const char *branch_name)
|
||||||
strbuf_stripspace(&buf, 1);
|
strbuf_stripspace(&buf, 1);
|
||||||
|
|
||||||
strbuf_addf(&name, "branch.%s.description", branch_name);
|
strbuf_addf(&name, "branch.%s.description", branch_name);
|
||||||
git_config_set_or_die(name.buf, buf.len ? buf.buf : NULL);
|
git_config_set(name.buf, buf.len ? buf.buf : NULL);
|
||||||
strbuf_release(&name);
|
strbuf_release(&name);
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
|
|
||||||
|
@ -790,10 +790,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
|
||||||
die(_("Branch '%s' has no upstream information"), branch->name);
|
die(_("Branch '%s' has no upstream information"), branch->name);
|
||||||
|
|
||||||
strbuf_addf(&buf, "branch.%s.remote", branch->name);
|
strbuf_addf(&buf, "branch.%s.remote", branch->name);
|
||||||
git_config_set_multivar_or_die(buf.buf, NULL, NULL, 1);
|
git_config_set_multivar(buf.buf, NULL, NULL, 1);
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "branch.%s.merge", branch->name);
|
strbuf_addf(&buf, "branch.%s.merge", branch->name);
|
||||||
git_config_set_multivar_or_die(buf.buf, NULL, NULL, 1);
|
git_config_set_multivar(buf.buf, NULL, NULL, 1);
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
} else if (argc > 0 && argc <= 2) {
|
} else if (argc > 0 && argc <= 2) {
|
||||||
struct branch *branch = branch_get(argv[0]);
|
struct branch *branch = branch_get(argv[0]);
|
||||||
|
|
|
@ -783,12 +783,12 @@ static void write_refspec_config(const char *src_ref_prefix,
|
||||||
/* Configure the remote */
|
/* Configure the remote */
|
||||||
if (value.len) {
|
if (value.len) {
|
||||||
strbuf_addf(&key, "remote.%s.fetch", option_origin);
|
strbuf_addf(&key, "remote.%s.fetch", option_origin);
|
||||||
git_config_set_multivar_or_die(key.buf, value.buf, "^$", 0);
|
git_config_set_multivar(key.buf, value.buf, "^$", 0);
|
||||||
strbuf_reset(&key);
|
strbuf_reset(&key);
|
||||||
|
|
||||||
if (option_mirror) {
|
if (option_mirror) {
|
||||||
strbuf_addf(&key, "remote.%s.mirror", option_origin);
|
strbuf_addf(&key, "remote.%s.mirror", option_origin);
|
||||||
git_config_set_or_die(key.buf, "true");
|
git_config_set(key.buf, "true");
|
||||||
strbuf_reset(&key);
|
strbuf_reset(&key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -946,14 +946,14 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
||||||
src_ref_prefix = "refs/";
|
src_ref_prefix = "refs/";
|
||||||
strbuf_addstr(&branch_top, src_ref_prefix);
|
strbuf_addstr(&branch_top, src_ref_prefix);
|
||||||
|
|
||||||
git_config_set_or_die("core.bare", "true");
|
git_config_set("core.bare", "true");
|
||||||
} else {
|
} else {
|
||||||
strbuf_addf(&branch_top, "refs/remotes/%s/", option_origin);
|
strbuf_addf(&branch_top, "refs/remotes/%s/", option_origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_addf(&value, "+%s*:%s*", src_ref_prefix, branch_top.buf);
|
strbuf_addf(&value, "+%s*:%s*", src_ref_prefix, branch_top.buf);
|
||||||
strbuf_addf(&key, "remote.%s.url", option_origin);
|
strbuf_addf(&key, "remote.%s.url", option_origin);
|
||||||
git_config_set_or_die(key.buf, repo);
|
git_config_set(key.buf, repo);
|
||||||
strbuf_reset(&key);
|
strbuf_reset(&key);
|
||||||
|
|
||||||
if (option_reference.nr)
|
if (option_reference.nr)
|
||||||
|
|
|
@ -227,7 +227,7 @@ static int create_default_files(const char *template_path)
|
||||||
/* This forces creation of new config file */
|
/* This forces creation of new config file */
|
||||||
xsnprintf(repo_version_string, sizeof(repo_version_string),
|
xsnprintf(repo_version_string, sizeof(repo_version_string),
|
||||||
"%d", GIT_REPO_VERSION);
|
"%d", GIT_REPO_VERSION);
|
||||||
git_config_set_or_die("core.repositoryformatversion", repo_version_string);
|
git_config_set("core.repositoryformatversion", repo_version_string);
|
||||||
|
|
||||||
/* Check filemode trustability */
|
/* Check filemode trustability */
|
||||||
path = git_path_buf(&buf, "config");
|
path = git_path_buf(&buf, "config");
|
||||||
|
@ -241,18 +241,18 @@ static int create_default_files(const char *template_path)
|
||||||
if (filemode && !reinit && (st1.st_mode & S_IXUSR))
|
if (filemode && !reinit && (st1.st_mode & S_IXUSR))
|
||||||
filemode = 0;
|
filemode = 0;
|
||||||
}
|
}
|
||||||
git_config_set_or_die("core.filemode", filemode ? "true" : "false");
|
git_config_set("core.filemode", filemode ? "true" : "false");
|
||||||
|
|
||||||
if (is_bare_repository())
|
if (is_bare_repository())
|
||||||
git_config_set_or_die("core.bare", "true");
|
git_config_set("core.bare", "true");
|
||||||
else {
|
else {
|
||||||
const char *work_tree = get_git_work_tree();
|
const char *work_tree = get_git_work_tree();
|
||||||
git_config_set_or_die("core.bare", "false");
|
git_config_set("core.bare", "false");
|
||||||
/* allow template config file to override the default */
|
/* allow template config file to override the default */
|
||||||
if (log_all_ref_updates == -1)
|
if (log_all_ref_updates == -1)
|
||||||
git_config_set_or_die("core.logallrefupdates", "true");
|
git_config_set("core.logallrefupdates", "true");
|
||||||
if (needs_work_tree_config(get_git_dir(), work_tree))
|
if (needs_work_tree_config(get_git_dir(), work_tree))
|
||||||
git_config_set_or_die("core.worktree", work_tree);
|
git_config_set("core.worktree", work_tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reinit) {
|
if (!reinit) {
|
||||||
|
@ -265,12 +265,12 @@ static int create_default_files(const char *template_path)
|
||||||
S_ISLNK(st1.st_mode))
|
S_ISLNK(st1.st_mode))
|
||||||
unlink(path); /* good */
|
unlink(path); /* good */
|
||||||
else
|
else
|
||||||
git_config_set_or_die("core.symlinks", "false");
|
git_config_set("core.symlinks", "false");
|
||||||
|
|
||||||
/* Check if the filesystem is case-insensitive */
|
/* Check if the filesystem is case-insensitive */
|
||||||
path = git_path_buf(&buf, "CoNfIg");
|
path = git_path_buf(&buf, "CoNfIg");
|
||||||
if (!access(path, F_OK))
|
if (!access(path, F_OK))
|
||||||
git_config_set_or_die("core.ignorecase", "true");
|
git_config_set("core.ignorecase", "true");
|
||||||
probe_utf8_pathname_composition();
|
probe_utf8_pathname_composition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,8 +386,8 @@ int init_db(const char *template_dir, unsigned int flags)
|
||||||
xsnprintf(buf, sizeof(buf), "%d", OLD_PERM_EVERYBODY);
|
xsnprintf(buf, sizeof(buf), "%d", OLD_PERM_EVERYBODY);
|
||||||
else
|
else
|
||||||
die("BUG: invalid value for shared_repository");
|
die("BUG: invalid value for shared_repository");
|
||||||
git_config_set_or_die("core.sharedrepository", buf);
|
git_config_set("core.sharedrepository", buf);
|
||||||
git_config_set_or_die("receive.denyNonFastforwards", "true");
|
git_config_set("receive.denyNonFastforwards", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & INIT_DB_QUIET)) {
|
if (!(flags & INIT_DB_QUIET)) {
|
||||||
|
|
|
@ -119,7 +119,7 @@ static void add_branch(const char *key, const char *branchname,
|
||||||
else
|
else
|
||||||
strbuf_addf(tmp, "refs/heads/%s:refs/remotes/%s/%s",
|
strbuf_addf(tmp, "refs/heads/%s:refs/remotes/%s/%s",
|
||||||
branchname, remotename, branchname);
|
branchname, remotename, branchname);
|
||||||
git_config_set_multivar_or_die(key, tmp->buf, "^$", 0);
|
git_config_set_multivar(key, tmp->buf, "^$", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char mirror_advice[] =
|
static const char mirror_advice[] =
|
||||||
|
@ -197,7 +197,7 @@ static int add(int argc, const char **argv)
|
||||||
die(_("'%s' is not a valid remote name"), name);
|
die(_("'%s' is not a valid remote name"), name);
|
||||||
|
|
||||||
strbuf_addf(&buf, "remote.%s.url", name);
|
strbuf_addf(&buf, "remote.%s.url", name);
|
||||||
git_config_set_or_die(buf.buf, url);
|
git_config_set(buf.buf, url);
|
||||||
|
|
||||||
if (!mirror || mirror & MIRROR_FETCH) {
|
if (!mirror || mirror & MIRROR_FETCH) {
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
|
@ -213,14 +213,14 @@ static int add(int argc, const char **argv)
|
||||||
if (mirror & MIRROR_PUSH) {
|
if (mirror & MIRROR_PUSH) {
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "remote.%s.mirror", name);
|
strbuf_addf(&buf, "remote.%s.mirror", name);
|
||||||
git_config_set_or_die(buf.buf, "true");
|
git_config_set(buf.buf, "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fetch_tags != TAGS_DEFAULT) {
|
if (fetch_tags != TAGS_DEFAULT) {
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "remote.%s.tagopt", name);
|
strbuf_addf(&buf, "remote.%s.tagopt", name);
|
||||||
git_config_set_or_die(buf.buf,
|
git_config_set(buf.buf,
|
||||||
fetch_tags == TAGS_SET ? "--tags" : "--no-tags");
|
fetch_tags == TAGS_SET ? "--tags" : "--no-tags");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fetch && fetch_remote(name))
|
if (fetch && fetch_remote(name))
|
||||||
|
@ -586,15 +586,15 @@ static int migrate_file(struct remote *remote)
|
||||||
|
|
||||||
strbuf_addf(&buf, "remote.%s.url", remote->name);
|
strbuf_addf(&buf, "remote.%s.url", remote->name);
|
||||||
for (i = 0; i < remote->url_nr; i++)
|
for (i = 0; i < remote->url_nr; i++)
|
||||||
git_config_set_multivar_or_die(buf.buf, remote->url[i], "^$", 0);
|
git_config_set_multivar(buf.buf, remote->url[i], "^$", 0);
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "remote.%s.push", remote->name);
|
strbuf_addf(&buf, "remote.%s.push", remote->name);
|
||||||
for (i = 0; i < remote->push_refspec_nr; i++)
|
for (i = 0; i < remote->push_refspec_nr; i++)
|
||||||
git_config_set_multivar_or_die(buf.buf, remote->push_refspec[i], "^$", 0);
|
git_config_set_multivar(buf.buf, remote->push_refspec[i], "^$", 0);
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "remote.%s.fetch", remote->name);
|
strbuf_addf(&buf, "remote.%s.fetch", remote->name);
|
||||||
for (i = 0; i < remote->fetch_refspec_nr; i++)
|
for (i = 0; i < remote->fetch_refspec_nr; i++)
|
||||||
git_config_set_multivar_or_die(buf.buf, remote->fetch_refspec[i], "^$", 0);
|
git_config_set_multivar(buf.buf, remote->fetch_refspec[i], "^$", 0);
|
||||||
if (remote->origin == REMOTE_REMOTES)
|
if (remote->origin == REMOTE_REMOTES)
|
||||||
unlink_or_warn(git_path("remotes/%s", remote->name));
|
unlink_or_warn(git_path("remotes/%s", remote->name));
|
||||||
else if (remote->origin == REMOTE_BRANCHES)
|
else if (remote->origin == REMOTE_BRANCHES)
|
||||||
|
@ -646,7 +646,7 @@ static int mv(int argc, const char **argv)
|
||||||
|
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "remote.%s.fetch", rename.new);
|
strbuf_addf(&buf, "remote.%s.fetch", rename.new);
|
||||||
git_config_set_multivar_or_die(buf.buf, NULL, NULL, 1);
|
git_config_set_multivar(buf.buf, NULL, NULL, 1);
|
||||||
strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old);
|
strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old);
|
||||||
for (i = 0; i < oldremote->fetch_refspec_nr; i++) {
|
for (i = 0; i < oldremote->fetch_refspec_nr; i++) {
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
@ -666,7 +666,7 @@ static int mv(int argc, const char **argv)
|
||||||
"\tPlease update the configuration manually if necessary."),
|
"\tPlease update the configuration manually if necessary."),
|
||||||
buf2.buf);
|
buf2.buf);
|
||||||
|
|
||||||
git_config_set_multivar_or_die(buf.buf, buf2.buf, "^$", 0);
|
git_config_set_multivar(buf.buf, buf2.buf, "^$", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
read_branches();
|
read_branches();
|
||||||
|
@ -676,7 +676,7 @@ static int mv(int argc, const char **argv)
|
||||||
if (info->remote_name && !strcmp(info->remote_name, rename.old)) {
|
if (info->remote_name && !strcmp(info->remote_name, rename.old)) {
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "branch.%s.remote", item->string);
|
strbuf_addf(&buf, "branch.%s.remote", item->string);
|
||||||
git_config_set_or_die(buf.buf, rename.new);
|
git_config_set(buf.buf, rename.new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,7 +774,7 @@ static int rm(int argc, const char **argv)
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "branch.%s.%s",
|
strbuf_addf(&buf, "branch.%s.%s",
|
||||||
item->string, *k);
|
item->string, *k);
|
||||||
git_config_set_or_die(buf.buf, NULL);
|
git_config_set(buf.buf, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1556,10 +1556,10 @@ static int set_url(int argc, const char **argv)
|
||||||
/* Special cases that add new entry. */
|
/* Special cases that add new entry. */
|
||||||
if ((!oldurl && !delete_mode) || add_mode) {
|
if ((!oldurl && !delete_mode) || add_mode) {
|
||||||
if (add_mode)
|
if (add_mode)
|
||||||
git_config_set_multivar_or_die(name_buf.buf, newurl,
|
git_config_set_multivar(name_buf.buf, newurl,
|
||||||
"^$", 0);
|
"^$", 0);
|
||||||
else
|
else
|
||||||
git_config_set_or_die(name_buf.buf, newurl);
|
git_config_set(name_buf.buf, newurl);
|
||||||
strbuf_release(&name_buf);
|
strbuf_release(&name_buf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1582,9 +1582,9 @@ static int set_url(int argc, const char **argv)
|
||||||
regfree(&old_regex);
|
regfree(&old_regex);
|
||||||
|
|
||||||
if (!delete_mode)
|
if (!delete_mode)
|
||||||
git_config_set_multivar_or_die(name_buf.buf, newurl, oldurl, 0);
|
git_config_set_multivar(name_buf.buf, newurl, oldurl, 0);
|
||||||
else
|
else
|
||||||
git_config_set_multivar_or_die(name_buf.buf, NULL, oldurl, 1);
|
git_config_set_multivar(name_buf.buf, NULL, oldurl, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,8 +245,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
|
||||||
p = git_pathdup_submodule(path, "config");
|
p = git_pathdup_submodule(path, "config");
|
||||||
if (!p)
|
if (!p)
|
||||||
die(_("could not get submodule directory for '%s'"), path);
|
die(_("could not get submodule directory for '%s'"), path);
|
||||||
git_config_set_in_file_or_die(p, "core.worktree",
|
git_config_set_in_file(p, "core.worktree",
|
||||||
relative_path(sb.buf, sm_gitdir, &rel_path));
|
relative_path(sb.buf, sm_gitdir, &rel_path));
|
||||||
strbuf_release(&sb);
|
strbuf_release(&sb);
|
||||||
strbuf_release(&rel_path);
|
strbuf_release(&rel_path);
|
||||||
free(sm_gitdir);
|
free(sm_gitdir);
|
||||||
|
|
8
cache.h
8
cache.h
|
@ -1523,15 +1523,15 @@ extern int git_config_maybe_bool(const char *, const char *);
|
||||||
extern int git_config_string(const char **, const char *, const char *);
|
extern int git_config_string(const char **, const char *, const char *);
|
||||||
extern int git_config_pathname(const char **, const char *, const char *);
|
extern int git_config_pathname(const char **, const char *, const char *);
|
||||||
extern int git_config_set_in_file_gently(const char *, const char *, const char *);
|
extern int git_config_set_in_file_gently(const char *, const char *, const char *);
|
||||||
extern void git_config_set_in_file_or_die(const char *, const char *, const char *);
|
extern void git_config_set_in_file(const char *, const char *, const char *);
|
||||||
extern int git_config_set_gently(const char *, const char *);
|
extern int git_config_set_gently(const char *, const char *);
|
||||||
extern void git_config_set_or_die(const char *, const char *);
|
extern void git_config_set(const char *, const char *);
|
||||||
extern int git_config_parse_key(const char *, char **, int *);
|
extern int git_config_parse_key(const char *, char **, int *);
|
||||||
extern int git_config_key_is_valid(const char *key);
|
extern int git_config_key_is_valid(const char *key);
|
||||||
extern int git_config_set_multivar_gently(const char *, const char *, const char *, int);
|
extern int git_config_set_multivar_gently(const char *, const char *, const char *, int);
|
||||||
extern void git_config_set_multivar_or_die(const char *, const char *, const char *, int);
|
extern void git_config_set_multivar(const char *, const char *, const char *, int);
|
||||||
extern int git_config_set_multivar_in_file_gently(const char *, const char *, const char *, const char *, int);
|
extern int git_config_set_multivar_in_file_gently(const char *, const char *, const char *, const char *, int);
|
||||||
extern void git_config_set_multivar_in_file_or_die(const char *, const char *, const char *, const char *, int);
|
extern void git_config_set_multivar_in_file(const char *, const char *, const char *, const char *, int);
|
||||||
extern int git_config_rename_section(const char *, const char *);
|
extern int git_config_rename_section(const char *, const char *);
|
||||||
extern int git_config_rename_section_in_file(const char *, const char *, const char *);
|
extern int git_config_rename_section_in_file(const char *, const char *, const char *);
|
||||||
extern const char *git_etc_gitconfig(void);
|
extern const char *git_etc_gitconfig(void);
|
||||||
|
|
|
@ -50,8 +50,8 @@ void probe_utf8_pathname_composition(void)
|
||||||
close(output_fd);
|
close(output_fd);
|
||||||
git_path_buf(&path, "%s", auml_nfd);
|
git_path_buf(&path, "%s", auml_nfd);
|
||||||
precomposed_unicode = access(path.buf, R_OK) ? 0 : 1;
|
precomposed_unicode = access(path.buf, R_OK) ? 0 : 1;
|
||||||
git_config_set_or_die("core.precomposeunicode",
|
git_config_set("core.precomposeunicode",
|
||||||
precomposed_unicode ? "true" : "false");
|
precomposed_unicode ? "true" : "false");
|
||||||
git_path_buf(&path, "%s", auml_nfc);
|
git_path_buf(&path, "%s", auml_nfc);
|
||||||
if (unlink(path.buf))
|
if (unlink(path.buf))
|
||||||
die_errno(_("failed to unlink '%s'"), path.buf);
|
die_errno(_("failed to unlink '%s'"), path.buf);
|
||||||
|
|
24
config.c
24
config.c
|
@ -1831,10 +1831,10 @@ int git_config_set_in_file_gently(const char *config_filename,
|
||||||
return git_config_set_multivar_in_file_gently(config_filename, key, value, NULL, 0);
|
return git_config_set_multivar_in_file_gently(config_filename, key, value, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void git_config_set_in_file_or_die(const char *config_filename,
|
void git_config_set_in_file(const char *config_filename,
|
||||||
const char *key, const char *value)
|
const char *key, const char *value)
|
||||||
{
|
{
|
||||||
git_config_set_multivar_in_file_or_die(config_filename, key, value, NULL, 0);
|
git_config_set_multivar_in_file(config_filename, key, value, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int git_config_set_gently(const char *key, const char *value)
|
int git_config_set_gently(const char *key, const char *value)
|
||||||
|
@ -1842,9 +1842,9 @@ int git_config_set_gently(const char *key, const char *value)
|
||||||
return git_config_set_multivar_gently(key, value, NULL, 0);
|
return git_config_set_multivar_gently(key, value, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void git_config_set_or_die(const char *key, const char *value)
|
void git_config_set(const char *key, const char *value)
|
||||||
{
|
{
|
||||||
git_config_set_multivar_or_die(key, value, NULL, 0);
|
git_config_set_multivar(key, value, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2191,9 +2191,9 @@ write_err_out:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void git_config_set_multivar_in_file_or_die(const char *config_filename,
|
void git_config_set_multivar_in_file(const char *config_filename,
|
||||||
const char *key, const char *value,
|
const char *key, const char *value,
|
||||||
const char *value_regex, int multi_replace)
|
const char *value_regex, int multi_replace)
|
||||||
{
|
{
|
||||||
if (git_config_set_multivar_in_file_gently(config_filename, key, value,
|
if (git_config_set_multivar_in_file_gently(config_filename, key, value,
|
||||||
value_regex, multi_replace) < 0)
|
value_regex, multi_replace) < 0)
|
||||||
|
@ -2207,11 +2207,11 @@ int git_config_set_multivar_gently(const char *key, const char *value,
|
||||||
multi_replace);
|
multi_replace);
|
||||||
}
|
}
|
||||||
|
|
||||||
void git_config_set_multivar_or_die(const char *key, const char *value,
|
void git_config_set_multivar(const char *key, const char *value,
|
||||||
const char *value_regex, int multi_replace)
|
const char *value_regex, int multi_replace)
|
||||||
{
|
{
|
||||||
git_config_set_multivar_in_file_or_die(NULL, key, value, value_regex,
|
git_config_set_multivar_in_file(NULL, key, value, value_regex,
|
||||||
multi_replace);
|
multi_replace);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int section_name_match (const char *buf, const char *name)
|
static int section_name_match (const char *buf, const char *name)
|
||||||
|
|
22
sequencer.c
22
sequencer.c
|
@ -933,31 +933,31 @@ static void save_opts(struct replay_opts *opts)
|
||||||
const char *opts_file = git_path_opts_file();
|
const char *opts_file = git_path_opts_file();
|
||||||
|
|
||||||
if (opts->no_commit)
|
if (opts->no_commit)
|
||||||
git_config_set_in_file_or_die(opts_file, "options.no-commit", "true");
|
git_config_set_in_file(opts_file, "options.no-commit", "true");
|
||||||
if (opts->edit)
|
if (opts->edit)
|
||||||
git_config_set_in_file_or_die(opts_file, "options.edit", "true");
|
git_config_set_in_file(opts_file, "options.edit", "true");
|
||||||
if (opts->signoff)
|
if (opts->signoff)
|
||||||
git_config_set_in_file_or_die(opts_file, "options.signoff", "true");
|
git_config_set_in_file(opts_file, "options.signoff", "true");
|
||||||
if (opts->record_origin)
|
if (opts->record_origin)
|
||||||
git_config_set_in_file_or_die(opts_file, "options.record-origin", "true");
|
git_config_set_in_file(opts_file, "options.record-origin", "true");
|
||||||
if (opts->allow_ff)
|
if (opts->allow_ff)
|
||||||
git_config_set_in_file_or_die(opts_file, "options.allow-ff", "true");
|
git_config_set_in_file(opts_file, "options.allow-ff", "true");
|
||||||
if (opts->mainline) {
|
if (opts->mainline) {
|
||||||
struct strbuf buf = STRBUF_INIT;
|
struct strbuf buf = STRBUF_INIT;
|
||||||
strbuf_addf(&buf, "%d", opts->mainline);
|
strbuf_addf(&buf, "%d", opts->mainline);
|
||||||
git_config_set_in_file_or_die(opts_file, "options.mainline", buf.buf);
|
git_config_set_in_file(opts_file, "options.mainline", buf.buf);
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
}
|
}
|
||||||
if (opts->strategy)
|
if (opts->strategy)
|
||||||
git_config_set_in_file_or_die(opts_file, "options.strategy", opts->strategy);
|
git_config_set_in_file(opts_file, "options.strategy", opts->strategy);
|
||||||
if (opts->gpg_sign)
|
if (opts->gpg_sign)
|
||||||
git_config_set_in_file_or_die(opts_file, "options.gpg-sign", opts->gpg_sign);
|
git_config_set_in_file(opts_file, "options.gpg-sign", opts->gpg_sign);
|
||||||
if (opts->xopts) {
|
if (opts->xopts) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < opts->xopts_nr; i++)
|
for (i = 0; i < opts->xopts_nr; i++)
|
||||||
git_config_set_multivar_in_file_or_die(opts_file,
|
git_config_set_multivar_in_file(opts_file,
|
||||||
"options.strategy-option",
|
"options.strategy-option",
|
||||||
opts->xopts[i], "^$", 0);
|
opts->xopts[i], "^$", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1034,9 +1034,9 @@ void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir)
|
||||||
/* Update core.worktree setting */
|
/* Update core.worktree setting */
|
||||||
strbuf_reset(&file_name);
|
strbuf_reset(&file_name);
|
||||||
strbuf_addf(&file_name, "%s/config", git_dir);
|
strbuf_addf(&file_name, "%s/config", git_dir);
|
||||||
git_config_set_in_file_or_die(file_name.buf, "core.worktree",
|
git_config_set_in_file(file_name.buf, "core.worktree",
|
||||||
relative_path(real_work_tree, git_dir,
|
relative_path(real_work_tree, git_dir,
|
||||||
&rel_path));
|
&rel_path));
|
||||||
|
|
||||||
strbuf_release(&file_name);
|
strbuf_release(&file_name);
|
||||||
strbuf_release(&rel_path);
|
strbuf_release(&rel_path);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче