submodule--helper clone: create the submodule path just once

We make sure that the parent directory of path exists (or create it otherwise) and then do the same for path + "/.git". That is equivalent to just making sure that the parent directory of path + "/.git" exists (or create it otherwise). Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Mar 31, 2016 at 14:04 UTC 47d5d6487902753f9483dc340de12551f90d4bdb
1 file changed -4
builtin/submodule--helper.c
-4
@@ -215,11 +215,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)
215 }
216
217 /* Write a .git file in the submodule to redirect to the superproject. */
218 - if (safe_create_leading_directories_const(path) < 0)
219 - die(_("could not create directory '%s'"), path);
220 -
218 strbuf_addf(&sb, "%s/.git", path);
222 -
219 if (safe_create_leading_directories_const(sb.buf) < 0)
220 die(_("could not create leading directories of '%s'"), sb.buf);
221 submodule_dot_git = fopen(sb.buf, "w");