Commit a145f2b642e41dec3522dc449a2ef947ccd7a337

Carlos Martín Nieto 2018-05-22T14:16:45

checkout: add a failing test for refusing a symlinked .gitmodules We want to reject these as they cause compatibility issues and can lead to git writing to files outside of the repository.

diff --git a/tests/checkout/nasty.c b/tests/checkout/nasty.c
index 952a6a1..7364779 100644
--- a/tests/checkout/nasty.c
+++ b/tests/checkout/nasty.c
@@ -364,3 +364,10 @@ void test_checkout_nasty__symlink3(void)
 	test_checkout_passes("refs/heads/symlink3", ".git/foobar");
 }
 
+void test_checkout_nasty__gitmodules_symlink(void)
+{
+	cl_repo_set_bool(repo, "core.protectHFS", true);
+	cl_repo_set_bool(repo, "core.protectNTFS", true);
+
+	test_checkout_passes("refs/heads/gitmodules-symlink", ".gitmodules");
+}
diff --git a/tests/resources/nasty/.gitted/objects/07/f9d4d85b75187e4db5b9cbcad3e6218582bd57 b/tests/resources/nasty/.gitted/objects/07/f9d4d85b75187e4db5b9cbcad3e6218582bd57
new file mode 100644
index 0000000..f040922
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/07/f9d4d85b75187e4db5b9cbcad3e6218582bd57 differ
diff --git a/tests/resources/nasty/.gitted/objects/2a/9eb82c733e31ae312cee349084dcbc6f69639a b/tests/resources/nasty/.gitted/objects/2a/9eb82c733e31ae312cee349084dcbc6f69639a
new file mode 100644
index 0000000..c4717d5
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/2a/9eb82c733e31ae312cee349084dcbc6f69639a differ
diff --git a/tests/resources/nasty/.gitted/objects/42/1376db9e8aee847e9d774891e73098a7415e94 b/tests/resources/nasty/.gitted/objects/42/1376db9e8aee847e9d774891e73098a7415e94
new file mode 100644
index 0000000..0666ba7
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/42/1376db9e8aee847e9d774891e73098a7415e94 differ
diff --git a/tests/resources/nasty/.gitted/objects/e3/0b60b120761f44ebd0f0a7b0e9445ce8e11d68 b/tests/resources/nasty/.gitted/objects/e3/0b60b120761f44ebd0f0a7b0e9445ce8e11d68
new file mode 100644
index 0000000..1c1be16
Binary files /dev/null and b/tests/resources/nasty/.gitted/objects/e3/0b60b120761f44ebd0f0a7b0e9445ce8e11d68 differ
diff --git a/tests/resources/nasty/.gitted/refs/heads/gitmodules-symlink b/tests/resources/nasty/.gitted/refs/heads/gitmodules-symlink
new file mode 100644
index 0000000..3a2499f
--- /dev/null
+++ b/tests/resources/nasty/.gitted/refs/heads/gitmodules-symlink
@@ -0,0 +1 @@
+e30b60b120761f44ebd0f0a7b0e9445ce8e11d68