Skip to content

Commit 336991d

Browse files
committed
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.
1 parent a3cbd20 commit 336991d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/index/tests.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ static void assert_write_fails(git_repository *repo, const char *fn_orig)
616616
*/
617617
fn = git__strdup(fn_orig);
618618
replace_char(fn, '/', '_');
619+
replace_char(fn, ':', '!');
619620

620621
git_buf_joinpath(&path, "./invalid", fn);
621622

@@ -627,6 +628,7 @@ static void assert_write_fails(git_repository *repo, const char *fn_orig)
627628

628629
/* kids, don't try this at home */
629630
replace_char((char *)entry->path, '_', '/');
631+
replace_char((char *)entry->path, '!', ':');
630632

631633
/* write-tree */
632634
cl_git_fail(git_index_write_tree(&expected, index));
@@ -700,6 +702,7 @@ void test_index_tests__honors_protect_filesystems(void)
700702
assert_write_fails(repo, ".git\xe2\x80\xad/hello");
701703
assert_write_fails(repo, "git~1/hello");
702704
assert_write_fails(repo, ".git\xe2\x81\xaf/hello");
705+
assert_write_fails(repo, ".git::$INDEX_ALLOCATION/dummy-file");
703706

704707
git_repository_free(repo);
705708

0 commit comments

Comments
 (0)