From: Johannes Schindelin Date: Wed, 4 Dec 2019 20:26:31 +0000 (+0100) Subject: Sync with 2.14.6 X-Git-Tag: v2.24.1~1^2~1^2~1^2~3^2~3^2~1^2~1^2~2^2~2^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d3ac8c3f27a507d0489d18b51d6deba6364a99ce;p=thirdparty%2Fgit.git Sync with 2.14.6 * maint-2.14: (28 commits) Git 2.14.6 mingw: handle `subst`-ed "DOS drives" mingw: refuse to access paths with trailing spaces or periods mingw: refuse to access paths with illegal characters unpack-trees: let merged_entry() pass through do_add_entry()'s errors quote-stress-test: offer to test quoting arguments for MSYS2 sh t6130/t9350: prepare for stringent Win32 path validation quote-stress-test: allow skipping some trials quote-stress-test: accept arguments to test via the command-line tests: add a helper to stress test argument quoting mingw: fix quoting of arguments Disallow dubiously-nested submodule git directories protect_ntfs: turn on NTFS protection by default path: also guard `.gitmodules` against NTFS Alternate Data Streams is_ntfs_dotgit(): speed it up mingw: disallow backslash characters in tree objects' file names path: safeguard `.git` against NTFS Alternate Streams Accesses clone --recurse-submodules: prevent name squatting on Windows is_ntfs_dotgit(): only verify the leading segment test-path-utils: offer to run a protectNTFS/protectHFS benchmark ... --- d3ac8c3f27a507d0489d18b51d6deba6364a99ce diff --cc builtin/submodule--helper.c index 30e0bb876c,3376b1bb29..0d03fa8bf9 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@@ -860,9 -861,11 +871,11 @@@ static int prepare_to_clone_next_submod argv_array_pushl(&child->args, "--prefix", suc->prefix, NULL); if (suc->recommend_shallow && sub->recommend_shallow == 1) argv_array_push(&child->args, "--depth=1"); + if (suc->require_init) + argv_array_push(&child->args, "--require-init"); argv_array_pushl(&child->args, "--path", sub->path, NULL); argv_array_pushl(&child->args, "--name", sub->name, NULL); - argv_array_pushl(&child->args, "--url", sub->url, NULL); + argv_array_pushl(&child->args, "--url", url, NULL); if (suc->references.nr) { struct string_list_item *item; for_each_string_list_item(item, &suc->references) diff --cc submodule.c index 63e7094e16,9abc90d9cd..2ae209f208 --- a/submodule.c +++ b/submodule.c @@@ -1794,6 -1837,52 +1794,47 @@@ int merge_submodule(struct object_id *r return 0; } -int parallel_submodules(void) -{ - return parallel_jobs; -} - + int validate_submodule_git_dir(char *git_dir, const char *submodule_name) + { + size_t len = strlen(git_dir), suffix_len = strlen(submodule_name); + char *p; + int ret = 0; + + if (len <= suffix_len || (p = git_dir + len - suffix_len)[-1] != '/' || + strcmp(p, submodule_name)) + BUG("submodule name '%s' not a suffix of git dir '%s'", + submodule_name, git_dir); + + /* + * We prevent the contents of sibling submodules' git directories to + * clash. + * + * Example: having a submodule named `hippo` and another one named + * `hippo/hooks` would result in the git directories + * `.git/modules/hippo/` and `.git/modules/hippo/hooks/`, respectively, + * but the latter directory is already designated to contain the hooks + * of the former. + */ + for (; *p; p++) { + if (is_dir_sep(*p)) { + char c = *p; + + *p = '\0'; + if (is_git_directory(git_dir)) + ret = -1; + *p = c; + + if (ret < 0) + return error(_("submodule git dir '%s' is " + "inside git dir '%.*s'"), + git_dir, + (int)(p - git_dir), git_dir); + } + } + + return 0; + } + /* * Embeds a single submodules git directory into the superprojects git dir, * non recursively.