Merge branch 'ps/config-error'
Many codepaths forget to check return value from git_config_set(); the function is made to die() to make sure we do not proceed when setting a configuration variable failed. * ps/config-error: config: rename git_config_set_or_die to git_config_set config: rename git_config_set to git_config_set_gently compat: die when unable to set core.precomposeunicode sequencer: die on config error when saving replay opts init-db: die on config errors when initializing empty repo clone: die on config error in cmd_clone remote: die on config error when manipulating remotes remote: die on config error when setting/adding branches remote: die on config error when setting URL submodule--helper: die on config error when cloning module submodule: die on config error when linking modules branch: die on config error when editing branch description branch: die on config error when unsetting upstream branch: report errors in tracking branch setup config: introduce set_or_die wrappers
This commit is contained in:
10
submodule.c
10
submodule.c
@ -69,7 +69,7 @@ int update_path_in_gitmodules(const char *oldpath, const char *newpath)
|
||||
strbuf_addstr(&entry, "submodule.");
|
||||
strbuf_addstr(&entry, submodule->name);
|
||||
strbuf_addstr(&entry, ".path");
|
||||
if (git_config_set_in_file(".gitmodules", entry.buf, newpath) < 0) {
|
||||
if (git_config_set_in_file_gently(".gitmodules", entry.buf, newpath) < 0) {
|
||||
/* Maybe the user already did that, don't error out here */
|
||||
warning(_("Could not update .gitmodules entry %s"), entry.buf);
|
||||
strbuf_release(&entry);
|
||||
@ -1087,11 +1087,9 @@ void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir)
|
||||
/* Update core.worktree setting */
|
||||
strbuf_reset(&file_name);
|
||||
strbuf_addf(&file_name, "%s/config", git_dir);
|
||||
if (git_config_set_in_file(file_name.buf, "core.worktree",
|
||||
relative_path(real_work_tree, git_dir,
|
||||
&rel_path)))
|
||||
die(_("Could not set core.worktree in %s"),
|
||||
file_name.buf);
|
||||
git_config_set_in_file(file_name.buf, "core.worktree",
|
||||
relative_path(real_work_tree, git_dir,
|
||||
&rel_path));
|
||||
|
||||
strbuf_release(&file_name);
|
||||
strbuf_release(&rel_path);
|
||||
|
Reference in New Issue
Block a user