summaryrefslogtreecommitdiff
path: root/tests/index/tests.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2014-12-16 19:24:04 -0600
committerEdward Thomson <ethomson@edwardthomson.com>2014-12-17 13:05:27 -0500
commitdce7b1a4e75551804a33591744d40d0582c57cfb (patch)
treefe3d7175cc770d1d3940a3d90672913817f5bc51 /tests/index/tests.c
parentec74b40ceef3dc3892c7d84bb4f5d99bab504ba4 (diff)
downloadlibgit2-dce7b1a4e75551804a33591744d40d0582c57cfb.tar.gz
treebuilder: take a repository for path validation
Path validation may be influenced by `core.protectHFS` and `core.protectNTFS` configuration settings, thus treebuilders can take a repository to influence their configuration.
Diffstat (limited to 'tests/index/tests.c')
-rw-r--r--tests/index/tests.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/index/tests.c b/tests/index/tests.c
index 0464e7337..a6c4b895c 100644
--- a/tests/index/tests.c
+++ b/tests/index/tests.c
@@ -421,6 +421,27 @@ void test_index_tests__write_invalid_filename(void)
cl_fixture_cleanup("invalid");
}
+void test_index_tests__honors_protect_filesystems(void)
+{
+ git_repository *repo;
+
+ p_mkdir("invalid", 0700);
+
+ cl_git_pass(git_repository_init(&repo, "./invalid", 0));
+
+ cl_repo_set_bool(repo, "core.protectHFS", true);
+ cl_repo_set_bool(repo, "core.protectNTFS", true);
+
+ write_invalid_filename(repo, ".git./hello");
+ write_invalid_filename(repo, ".git\xe2\x80\xad/hello");
+ write_invalid_filename(repo, "git~1/hello");
+ write_invalid_filename(repo, ".git\xe2\x81\xaf/hello");
+
+ git_repository_free(repo);
+
+ cl_fixture_cleanup("invalid");
+}
+
void test_index_tests__remove_entry(void)
{
git_repository *repo;