Commit f43ade0e by Carlos Martín Nieto Committed by Patrick Steinhardt

path: provide a generic dogit checking function for HFS

This lets us check for other kinds of reserved files.
parent 4a1753c2
...@@ -1560,18 +1560,31 @@ static int32_t next_hfs_char(const char **in, size_t *len) ...@@ -1560,18 +1560,31 @@ static int32_t next_hfs_char(const char **in, size_t *len)
return 0; /* NULL byte -- end of string */ return 0; /* NULL byte -- end of string */
} }
static bool verify_dotgit_hfs(const char *path, size_t len) static bool verify_dotgit_hfs_generic(const char *path, size_t len, const char *needle, size_t needle_len)
{ {
if (next_hfs_char(&path, &len) != '.' || size_t i;
next_hfs_char(&path, &len) != 'g' || char c;
next_hfs_char(&path, &len) != 'i' ||
next_hfs_char(&path, &len) != 't' || if (next_hfs_char(&path, &len) != '.')
next_hfs_char(&path, &len) != 0) return true;
for (i = 0; i < needle_len; i++) {
c = next_hfs_char(&path, &len);
if (c != needle[i])
return true;
}
if (next_hfs_char(&path, &len) != '\0')
return true; return true;
return false; return false;
} }
static bool verify_dotgit_hfs(const char *path, size_t len)
{
return verify_dotgit_hfs_generic(path, len, "git", CONST_STRLEN("git"));
}
GIT_INLINE(bool) verify_dotgit_ntfs(git_repository *repo, const char *path, size_t len) GIT_INLINE(bool) verify_dotgit_ntfs(git_repository *repo, const char *path, size_t len)
{ {
git_buf *reserved = git_repository__reserved_names_win32; git_buf *reserved = git_repository__reserved_names_win32;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment