Skip to content

Commit 15b92fc

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1a90dfe commit 15b92fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

builtin/submodule--helper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
245245
p = git_pathdup_submodule(path, "config");
246246
if (!p)
247247
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));
250250
strbuf_release(&sb);
251251
strbuf_release(&rel_path);
252252
free(sm_gitdir);

0 commit comments

Comments
 (0)