summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Patrick Steinhardt <ps@pks.im>2016-02-22 12:23:27 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-02-22 10:23:52 -0800
commit15b92fc05239a3c4f9af6177c1bfae1bcf2d5dce (patch)
treeb30903b0f0be2c658824921a4c7addba0d9e9430
parentsubmodule: die on config error when linking modules (diff)
downloadtgif-15b92fc05239a3c4f9af6177c1bfae1bcf2d5dce.tar.xz
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>
-rw-r--r--builtin/submodule--helper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index f4c3eff179..c7e1ea2799 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -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);