summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-02-16 17:11:46 +0000
committerEdward Thomson <ethomson@github.com>2016-02-17 13:10:33 +0000
commit318b825e76a9dc8afefc8274c5271747ad64d5a9 (patch)
tree3d800c50d67c7ed818060da8d155f1c006b62f00 /src/path.c
parent4fea9cffbda89562bfdcdd58b0162d31ca4feb3e (diff)
downloadlibgit2-318b825e76a9dc8afefc8274c5271747ad64d5a9.tar.gz
index: allow read of index w/ illegal entries
Allow `git_index_read` to handle reading existing indexes with illegal entries. Allow the low-level `git_index_add` to add properly formed `git_index_entry`s even if they contain paths that would be illegal for the current filesystem (eg, `AUX`). Continue to disallow `git_index_add_bypath` from adding entries that are illegal universally illegal (eg, `.git`, `foo/../bar`).
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/path.c b/src/path.c
index 18b4f03fd..852ef576a 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1630,9 +1630,12 @@ static bool verify_component(
!verify_dotgit_ntfs(repo, component, len))
return false;
+ /* don't bother rerunning the `.git` test if we ran the HFS or NTFS
+ * specific tests, they would have already rejected `.git`.
+ */
if ((flags & GIT_PATH_REJECT_DOT_GIT_HFS) == 0 &&
(flags & GIT_PATH_REJECT_DOT_GIT_NTFS) == 0 &&
- (flags & GIT_PATH_REJECT_DOT_GIT) &&
+ (flags & GIT_PATH_REJECT_DOT_GIT_LITERAL) &&
len == 4 &&
component[0] == '.' &&
(component[1] == 'g' || component[1] == 'G') &&
@@ -1649,6 +1652,8 @@ GIT_INLINE(unsigned int) dotgit_flags(
{
int protectHFS = 0, protectNTFS = 0;
+ flags |= GIT_PATH_REJECT_DOT_GIT_LITERAL;
+
#ifdef __APPLE__
protectHFS = 1;
#endif