From: Junio C Hamano Date: Tue, 22 May 2018 05:10:49 +0000 (+0900) Subject: Sync with Git 2.13.7 X-Git-Tag: v2.14.4~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b01c71b64d25202d80b73cbd46104ebfddbdab3;p=thirdparty%2Fgit.git Sync with Git 2.13.7 * maint-2.13: Git 2.13.7 verify_path: disallow symlinks in .gitmodules update-index: stat updated files earlier verify_dotfile: mention case-insensitivity in comment verify_path: drop clever fallthrough skip_prefix: add case-insensitive variant is_{hfs,ntfs}_dotgitmodules: add tests is_ntfs_dotgit: match other .git files is_hfs_dotgit: match other .git files is_ntfs_dotgit: use a size_t for traversing string submodule-config: verify submodule names as paths --- 7b01c71b64d25202d80b73cbd46104ebfddbdab3 diff --cc builtin/submodule--helper.c index 895555c93a,b4b4d29d82..e8ccddd3b1 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@@ -1224,9 -1192,32 +1224,32 @@@ static int is_active(int argc, const ch gitmodules_config(); - return !is_submodule_initialized(argv[1]); + return !is_submodule_active(the_repository, argv[1]); } + /* + * Exit non-zero if any of the submodule names given on the command line is + * invalid. If no names are given, filter stdin to print only valid names + * (which is primarily intended for testing). + */ + static int check_name(int argc, const char **argv, const char *prefix) + { + if (argc > 1) { + while (*++argv) { + if (check_submodule_name(*argv) < 0) + return 1; + } + } else { + struct strbuf buf = STRBUF_INIT; + while (strbuf_getline(&buf, stdin) != EOF) { + if (!check_submodule_name(buf.buf)) + printf("%s\n", buf.buf); + } + strbuf_release(&buf); + } + return 0; + } + #define SUPPORT_SUPER_PREFIX (1<<0) struct cmd_struct { diff --cc cache.h index 5cc116ba42,5a44f79e26..ffadd5bc70 --- a/cache.h +++ b/cache.h @@@ -604,9 -597,8 +604,9 @@@ extern int read_index_unmerged(struct i #define CLOSE_LOCK (1 << 1) extern int write_locked_index(struct index_state *, struct lock_file *lock, unsigned flags); extern int discard_index(struct index_state *); +extern void move_index_extensions(struct index_state *dst, struct index_state *src); extern int unmerged_index(const struct index_state *); - extern int verify_path(const char *path); + extern int verify_path(const char *path, unsigned mode); extern int strcmp_offset(const char *s1, const char *s2, size_t *first_change); extern int index_dir_exists(struct index_state *istate, const char *name, int namelen); extern void adjust_dirname_case(struct index_state *istate, char *name); diff --cc t/helper/test-path-utils.c index 2b3c5092a1,77517a43ed..94846550f7 --- a/t/helper/test-path-utils.c +++ b/t/helper/test-path-utils.c @@@ -265,11 -257,25 +271,25 @@@ int cmd_main(int argc, const char **arg } if (argc == 2 && !strcmp(argv[1], "basename")) - return test_function(basename_data, basename, argv[1]); + return test_function(basename_data, posix_basename, argv[1]); if (argc == 2 && !strcmp(argv[1], "dirname")) - return test_function(dirname_data, dirname, argv[1]); + return test_function(dirname_data, posix_dirname, argv[1]); + if (argc > 2 && !strcmp(argv[1], "is_dotgitmodules")) { + int res = 0, expect = 1, i; + for (i = 2; i < argc; i++) + if (!strcmp("--not", argv[i])) + expect = !expect; + else if (expect != is_dotgitmodules(argv[i])) + res = error("'%s' is %s.gitmodules", argv[i], + expect ? "not " : ""); + else + fprintf(stderr, "ok: '%s' is %s.gitmodules\n", + argv[i], expect ? "" : "not "); + return !!res; + } + fprintf(stderr, "%s: unknown function name: %s\n", argv[0], argv[1] ? argv[1] : "(there was none)"); return 1;