@@ -1561,18 +1561,31 @@ static int32_t next_hfs_char(const char **in, size_t *len)
15611561 return 0 ; /* NULL byte -- end of string */
15621562}
15631563
1564- static bool verify_dotgit_hfs (const char * path , size_t len )
1564+ static bool verify_dotgit_hfs_generic (const char * path , size_t len , const char * needle , size_t needle_len )
15651565{
1566- if (next_hfs_char (& path , & len ) != '.' ||
1567- next_hfs_char (& path , & len ) != 'g' ||
1568- next_hfs_char (& path , & len ) != 'i' ||
1569- next_hfs_char (& path , & len ) != 't' ||
1570- next_hfs_char (& path , & len ) != 0 )
1566+ size_t i ;
1567+ char c ;
1568+
1569+ if (next_hfs_char (& path , & len ) != '.' )
1570+ return true;
1571+
1572+ for (i = 0 ; i < needle_len ; i ++ ) {
1573+ c = next_hfs_char (& path , & len );
1574+ if (c != needle [i ])
1575+ return true;
1576+ }
1577+
1578+ if (next_hfs_char (& path , & len ) != '\0' )
15711579 return true;
15721580
15731581 return false;
15741582}
15751583
1584+ static bool verify_dotgit_hfs (const char * path , size_t len )
1585+ {
1586+ return verify_dotgit_hfs_generic (path , len , "git" , CONST_STRLEN ("git" ));
1587+ }
1588+
15761589GIT_INLINE (bool ) verify_dotgit_ntfs (git_repository * repo , const char * path , size_t len )
15771590{
15781591 git_buf * reserved = git_repository__reserved_names_win32 ;
0 commit comments