File 0008-index-ensure-that-we-respect-core.protectNTFS-false.patch of Package libgit2.28345
From cf130e6de98e23f95ab32db91b1778deda0fe895 Mon Sep 17 00:00:00 2001
From: Edward Thomson <ethomson@edwardthomson.com>
Date: Tue, 3 Dec 2019 19:50:18 +1100
Subject: [PATCH] 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.
---
tests/index/tests.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tests/index/tests.c b/tests/index/tests.c
index e1e194e1218..8ca4939fe30 100644
--- a/tests/index/tests.c
+++ b/tests/index/tests.c
@@ -667,6 +667,26 @@ void test_index_tests__protectntfs_on_by_default(void)
cl_fixture_cleanup("invalid");
}
+void test_index_tests__can_disable_protectntfs(void)
+{
+ git_repository *repo;
+ git_index *index;
+
+ cl_must_pass(p_mkdir("valid", 0700));
+ cl_git_rewritefile("valid/git~1", "steal the shortname");
+
+ cl_git_pass(git_repository_init(&repo, "./valid", 0));
+ cl_git_pass(git_repository_index(&index, repo));
+ cl_repo_set_bool(repo, "core.protectNTFS", false);
+
+ cl_git_pass(git_index_add_bypath(index, "git~1"));
+
+ git_index_free(index);
+ git_repository_free(repo);
+
+ cl_fixture_cleanup("valid");
+}
+
void test_index_tests__remove_entry(void)
{
git_repository *repo;