Skip to content

Commit 85d4ff7

Browse files
committed
index: ensure that we respect core.protectNTFS=false
Users may want to turn off core.protectNTFS, perhaps to import (and then repair) a broken tree. Ensure that core.protectNTFS=false is honored.
1 parent ba4c769 commit 85d4ff7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/index/tests.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,26 @@ void test_index_tests__protectntfs_on_by_default(void)
780780
cl_fixture_cleanup("invalid");
781781
}
782782

783+
void test_index_tests__can_disable_protectntfs(void)
784+
{
785+
git_repository *repo;
786+
git_index *index;
787+
788+
cl_must_pass(p_mkdir("valid", 0700));
789+
cl_git_rewritefile("valid/git~1", "steal the shortname");
790+
791+
cl_git_pass(git_repository_init(&repo, "./valid", 0));
792+
cl_git_pass(git_repository_index(&index, repo));
793+
cl_repo_set_bool(repo, "core.protectNTFS", false);
794+
795+
cl_git_pass(git_index_add_bypath(index, "git~1"));
796+
797+
git_index_free(index);
798+
git_repository_free(repo);
799+
800+
cl_fixture_cleanup("valid");
801+
}
802+
783803
void test_index_tests__remove_entry(void)
784804
{
785805
git_repository *repo;

0 commit comments

Comments
 (0)