summaryrefslogtreecommitdiff
path: root/tests/path/dotgit.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2018-05-22 16:13:47 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2018-05-23 08:47:08 +0200
commita7168b47ee494c52ffe850784be9ad996f80441a (patch)
tree290ea63c787104e9bdc36eaf0d0ef0316f6e2abc /tests/path/dotgit.c
parent58ff913a13b840f1f6ee35e71e9d1de3470904ad (diff)
downloadlibgit2-a7168b47ee494c52ffe850784be9ad996f80441a.tar.gz
path: reject .gitmodules as a symlink
Any part of the library which asks the question can pass in the mode to have it checked against `.gitmodules` being a symlink. This is particularly relevant for adding entries to the index from the worktree and for checking out files.
Diffstat (limited to 'tests/path/dotgit.c')
-rw-r--r--tests/path/dotgit.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/path/dotgit.c b/tests/path/dotgit.c
index 038e849c2..cad1e2586 100644
--- a/tests/path/dotgit.c
+++ b/tests/path/dotgit.c
@@ -106,3 +106,10 @@ void test_path_dotgit__dotgit_modules(void)
}
}
+
+void test_path_dotgit__dotgit_modules_symlink(void)
+{
+ cl_assert_equal_b(true, git_path_isvalid(NULL, ".gitmodules", 0, GIT_PATH_REJECT_DOT_GIT_HFS|GIT_PATH_REJECT_DOT_GIT_NTFS));
+ cl_assert_equal_b(false, git_path_isvalid(NULL, ".gitmodules", S_IFLNK, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_isvalid(NULL, ".gitmodules", S_IFLNK, GIT_PATH_REJECT_DOT_GIT_NTFS));
+}