diff options
| author | Edward Thomson <ethomson@github.com> | 2016-02-16 17:11:46 +0000 |
|---|---|---|
| committer | Edward Thomson <ethomson@github.com> | 2016-02-17 13:10:33 +0000 |
| commit | 318b825e76a9dc8afefc8274c5271747ad64d5a9 (patch) | |
| tree | 3d800c50d67c7ed818060da8d155f1c006b62f00 /src/path.c | |
| parent | 4fea9cffbda89562bfdcdd58b0162d31ca4feb3e (diff) | |
| download | libgit2-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.c | 7 |
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 |
