Skip to content

Commit

Permalink
submodule--helper: die on config error when cloning module
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Patrick Steinhardt authored and Junio C Hamano committed Feb 22, 2016
1 parent 1a90dfe commit 15b92fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions builtin/submodule--helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
p = git_pathdup_submodule(path, "config");
if (!p)
die(_("could not get submodule directory for '%s'"), path);
git_config_set_in_file(p, "core.worktree",
relative_path(sb.buf, sm_gitdir, &rel_path));
git_config_set_in_file_or_die(p, "core.worktree",
relative_path(sb.buf, sm_gitdir, &rel_path));
strbuf_release(&sb);
strbuf_release(&rel_path);
free(sm_gitdir);
Expand Down

0 comments on commit 15b92fc

Please sign in to comment.