summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-12-03 18:56:31 +1100
committerPatrick Steinhardt <ps@pks.im>2019-12-10 11:04:48 +0100
commitfd255d2c94f36a0697186efa39a1c534f6a4b052 (patch)
tree27ecbaeb1c0ecd2f4697806a169f8045bf1e2985
parenta336ed185fbc61ed0dd9bc897d85562b59b2f537 (diff)
downloadlibgit2-fd255d2c94f36a0697186efa39a1c534f6a4b052.tar.gz
test: ensure index adds validate new protection rules
Ensure that the new protection around .git::$INDEX_ALLOCATION rules are enabled for adding to the index when core.protectNTFS is set.
-rw-r--r--tests/index/tests.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/index/tests.c b/tests/index/tests.c
index 3417f0ab7..8fd1e12f3 100644
--- a/tests/index/tests.c
+++ b/tests/index/tests.c
@@ -616,6 +616,7 @@ static void assert_write_fails(git_repository *repo, const char *fn_orig)
*/
fn = git__strdup(fn_orig);
replace_char(fn, '/', '_');
+ replace_char(fn, ':', '!');
git_buf_joinpath(&path, "./invalid", fn);
@@ -627,6 +628,7 @@ static void assert_write_fails(git_repository *repo, const char *fn_orig)
/* kids, don't try this at home */
replace_char((char *)entry->path, '_', '/');
+ replace_char((char *)entry->path, '!', ':');
/* write-tree */
cl_git_fail(git_index_write_tree(&expected, index));
@@ -700,6 +702,7 @@ void test_index_tests__honors_protect_filesystems(void)
assert_write_fails(repo, ".git\xe2\x80\xad/hello");
assert_write_fails(repo, "git~1/hello");
assert_write_fails(repo, ".git\xe2\x81\xaf/hello");
+ assert_write_fails(repo, ".git::$INDEX_ALLOCATION/dummy-file");
git_repository_free(repo);