submodule--helper: die on config error when cloning module
When setting the 'core.worktree' option for a newly cloned submodule we ignore the return value of `git_config_set_in_file`. As this leaves the submodule in an inconsistent state, we instead want to inform the user that something has gone wrong by printing an error and aborting the program. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
1a90dfe8a7
commit
15b92fc052
@ -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(p, "core.worktree",
|
git_config_set_in_file_or_die(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);
|
||||||
|
Loading…
Reference in New Issue
Block a user