]> git.ipfire.org Git - thirdparty/git.git/blobdiff - read-cache.c
Merge branch 'es/submodule-fetch-message-fix' into maint
[thirdparty/git.git] / read-cache.c
index 06744287a11acd4f623eaaaee9a4ef1d4173542b..aa427c5c170f02c0c2300f4de5e16a03c83dd975 100644 (file)
@@ -959,11 +959,14 @@ static int verify_dotfile(const char *rest, unsigned mode)
 
 int verify_path(const char *path, unsigned mode)
 {
-       char c;
+       char c = 0;
 
        if (has_dos_drive_prefix(path))
                return 0;
 
+       if (!is_valid_path(path))
+               return 0;
+
        goto inside;
        for (;;) {
                if (!c)
@@ -971,6 +974,7 @@ int verify_path(const char *path, unsigned mode)
                if (is_dir_sep(c)) {
 inside:
                        if (protect_hfs) {
+
                                if (is_hfs_dotgit(path))
                                        return 0;
                                if (S_ISLNK(mode)) {
@@ -979,6 +983,10 @@ inside:
                                }
                        }
                        if (protect_ntfs) {
+#ifdef GIT_WINDOWS_NATIVE
+                               if (c == '\\')
+                                       return 0;
+#endif
                                if (is_ntfs_dotgit(path))
                                        return 0;
                                if (S_ISLNK(mode)) {
@@ -991,7 +999,15 @@ inside:
                        if ((c == '.' && !verify_dotfile(path, mode)) ||
                            is_dir_sep(c) || c == '\0')
                                return 0;
+               } else if (c == '\\' && protect_ntfs) {
+                       if (is_ntfs_dotgit(path))
+                               return 0;
+                       if (S_ISLNK(mode)) {
+                               if (is_ntfs_dotgitmodules(path))
+                                       return 0;
+                       }
                }
+
                c = *path++;
        }
 }