Sync with Git 2.17.1
* maint: (25 commits) Git 2.17.1 Git 2.16.4 Git 2.15.2 Git 2.14.4 Git 2.13.7 fsck: complain when .gitmodules is a symlink index-pack: check .gitmodules files with --strict unpack-objects: call fsck_finish() after fscking objects fsck: call fsck_finish() after fscking objects fsck: check .gitmodules content fsck: handle promisor objects in .gitmodules check fsck: detect gitmodules files fsck: actually fsck blob data fsck: simplify ".git" check index-pack: make fsck error message more specific 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 ...
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
#include "test-tool.h"
|
||||
#include "cache.h"
|
||||
#include "string-list.h"
|
||||
#include "utf8.h"
|
||||
|
||||
/*
|
||||
* A "string_list_each_func_t" function that normalizes an entry from
|
||||
@ -171,6 +172,11 @@ static struct test_data dirname_data[] = {
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static int is_dotgitmodules(const char *path)
|
||||
{
|
||||
return is_hfs_dotgitmodules(path) || is_ntfs_dotgitmodules(path);
|
||||
}
|
||||
|
||||
int cmd__path_utils(int argc, const char **argv)
|
||||
{
|
||||
if (argc == 3 && !strcmp(argv[1], "normalize_path_copy")) {
|
||||
@ -271,6 +277,20 @@ int cmd__path_utils(int argc, const char **argv)
|
||||
if (argc == 2 && !strcmp(argv[1], "dirname"))
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user