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>
Patrick Steinhardt committed
Feb 22, 2016 at 12:23 UTC
15b92fc05239a3c4f9af6177c1bfae1bcf2d5dce
1 file changed
+2
-2
builtin/submodule--helper.c
+2
-2
@@ -245,8 +245,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
245
p = git_pathdup_submodule(path, "config");
246
if (!p)
247
die(_("could not get submodule directory for '%s'"), path);
248
- git_config_set_in_file(p, "core.worktree",
249
- relative_path(sb.buf, sm_gitdir, &rel_path));
248
+ git_config_set_in_file_or_die(p, "core.worktree",
249
+ relative_path(sb.buf, sm_gitdir, &rel_path));
250
strbuf_release(&sb);
251
strbuf_release(&rel_path);
252
free(sm_gitdir);