diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/checkout/nasty.c | 32 | ||||
-rw-r--r-- | tests/path/core.c | 22 |
2 files changed, 51 insertions, 3 deletions
diff --git a/tests/checkout/nasty.c b/tests/checkout/nasty.c index a667dcd8f..c07d9382a 100644 --- a/tests/checkout/nasty.c +++ b/tests/checkout/nasty.c @@ -291,3 +291,35 @@ void test_checkout_nasty__dot_git_hfs_ignorable(void) test_checkout_fails("refs/heads/dotgit_hfs_ignorable_16", ".git/foobar"); #endif } + +void test_checkout_nasty__honors_core_protecthfs(void) +{ + cl_repo_set_bool(repo, "core.protectHFS", true); + + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_1", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_2", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_3", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_4", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_5", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_6", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_7", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_8", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_9", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_10", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_11", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_12", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_13", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_14", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_15", ".git/foobar"); + test_checkout_fails("refs/heads/dotgit_hfs_ignorable_16", ".git/foobar"); +} + +void test_checkout_nasty__honors_core_protectntfs(void) +{ + cl_repo_set_bool(repo, "core.protectNTFS", true); + + test_checkout_fails("refs/heads/dotgit_backslash_path", ".git/foobar"); + test_checkout_fails("refs/heads/dotcapitalgit_backslash_path", ".GIT/foobar"); + test_checkout_fails("refs/heads/dot_git_dot", ".git/foobar"); + test_checkout_fails("refs/heads/git_tilde1", ".git/foobar"); +} diff --git a/tests/path/core.c b/tests/path/core.c index 528108bea..85fee820a 100644 --- a/tests/path/core.c +++ b/tests/path/core.c @@ -172,11 +172,27 @@ void test_path_core__isvalid_trailing_colon(void) cl_assert_equal_b(false, git_path_isvalid(NULL, "foo:/bar", GIT_PATH_REJECT_TRAILING_COLON)); } -void test_path_core__isvalid_dos_git_shortname(void) +void test_path_core__isvalid_dotgit_ntfs(void) { - cl_assert_equal_b(true, git_path_isvalid(NULL, "git~1", 0)); + cl_assert_equal_b(true, git_path_isvalid(NULL, ".git", 0)); + cl_assert_equal_b(true, git_path_isvalid(NULL, ".git ", 0)); + cl_assert_equal_b(true, git_path_isvalid(NULL, ".git.", 0)); + cl_assert_equal_b(true, git_path_isvalid(NULL, ".git.. .", 0)); - cl_assert_equal_b(false, git_path_isvalid(NULL, "git~1", GIT_PATH_REJECT_DOS_GIT_SHORTNAME)); + cl_assert_equal_b(true, git_path_isvalid(NULL, "git~1", 0)); + cl_assert_equal_b(true, git_path_isvalid(NULL, "git~1 ", 0)); + cl_assert_equal_b(true, git_path_isvalid(NULL, "git~1.", 0)); + cl_assert_equal_b(true, git_path_isvalid(NULL, "git~1.. .", 0)); + + cl_assert_equal_b(false, git_path_isvalid(NULL, ".git", GIT_PATH_REJECT_DOT_GIT_NTFS)); + cl_assert_equal_b(false, git_path_isvalid(NULL, ".git ", GIT_PATH_REJECT_DOT_GIT_NTFS)); + cl_assert_equal_b(false, git_path_isvalid(NULL, ".git.", GIT_PATH_REJECT_DOT_GIT_NTFS)); + cl_assert_equal_b(false, git_path_isvalid(NULL, ".git.. .", GIT_PATH_REJECT_DOT_GIT_NTFS)); + + cl_assert_equal_b(false, git_path_isvalid(NULL, "git~1", GIT_PATH_REJECT_DOT_GIT_NTFS)); + cl_assert_equal_b(false, git_path_isvalid(NULL, "git~1 ", GIT_PATH_REJECT_DOT_GIT_NTFS)); + cl_assert_equal_b(false, git_path_isvalid(NULL, "git~1.", GIT_PATH_REJECT_DOT_GIT_NTFS)); + cl_assert_equal_b(false, git_path_isvalid(NULL, "git~1.. .", GIT_PATH_REJECT_DOT_GIT_NTFS)); } void test_path_core__isvalid_dos_paths(void) |