path: expose dotgit detection functions per filesystem These will be used by the checkout code to detect them for the particular filesystem they're on.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
diff --git a/src/path.c b/src/path.c
index 26a7d59..560cf86 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1849,17 +1849,56 @@ static int verify_dotgit_generic(const char *name, const char *dotgit_name, cons
return verify_dotgit_hfs_generic(name, strlen(name), dotgit_name, strlen(dotgit_name));
}
+int git_path_is_ntfs_dotgit_modules(const char *name)
+{
+ return !verify_dotgit_ntfs_generic(name, "gitmodules", "gi7eba");
+}
+
+int git_path_is_hfs_dotgit_modules(const char *name)
+{
+ return !verify_dotgit_hfs_generic(name, strlen(name), "gitmodules", CONST_STRLEN("gitmodules"));
+}
+
int git_path_is_dotgit_modules(const char *name)
{
- return !verify_dotgit_generic(name, "gitmodules", "gi7eba");
+ if (git_path_is_hfs_dotgit_modules(name))
+ return 1;
+
+ return git_path_is_ntfs_dotgit_modules(name);
+}
+
+int git_path_is_ntfs_dotgit_ignore(const char *name)
+{
+ return !verify_dotgit_ntfs_generic(name, "gitignore", "gi250a");
+}
+
+int git_path_is_hfs_dotgit_ignore(const char *name)
+{
+ return !verify_dotgit_hfs_generic(name, strlen(name), "gitignore", CONST_STRLEN("gitignore"));
}
int git_path_is_dotgit_ignore(const char *name)
{
- return !verify_dotgit_generic(name, "gitignore", "gi250a");
+ if (git_path_is_hfs_dotgit_ignore(name))
+ return 1;
+
+ return git_path_is_ntfs_dotgit_ignore(name);
+}
+
+int git_path_is_hfs_dotgit_attributes(const char *name)
+{
+ return !verify_dotgit_hfs_generic(name, strlen(name), "gitattributes", CONST_STRLEN("gitattributes"));
+}
+
+int git_path_is_ntfs_dotgit_attributes(const char *name)
+{
+ return !verify_dotgit_ntfs_generic(name, "gitattributes", "gi7d29");
}
int git_path_is_dotgit_attributes(const char *name)
{
- return !verify_dotgit_generic(name, "gitattributes", "gi7d29");
+ if (git_path_is_hfs_dotgit_attributes(name))
+ return 1;
+
+ return git_path_is_ntfs_dotgit_attributes(name);
}
diff --git a/src/path.h b/src/path.h
index a845a3f..553608a 100644
--- a/src/path.h
+++ b/src/path.h
@@ -638,6 +638,20 @@ int git_path_normalize_slashes(git_buf *out, const char *path);
extern int git_path_is_dotgit_modules(const char *name);
/**
+ * Check whether a path component corresponds to a .gitmodules file in NTFS
+ *
+ * @param name the path component to check
+ */
+extern int git_path_is_ntfs_dotgit_modules(const char *name);
+
+/**
+ * Check whether a path component corresponds to a .gitmodules file in HFS+
+ *
+ * @param name the path component to check
+ */
+extern int git_path_is_hfs_dotgit_modules(const char *name);
+
+/**
* Check whether a path component corresponds to a .gitignore file
*
* @param name the path component to check
@@ -645,10 +659,38 @@ extern int git_path_is_dotgit_modules(const char *name);
extern int git_path_is_dotgit_ignore(const char *name);
/**
+ * Check whether a path component corresponds to a .gitignore file in NTFS
+ *
+ * @param name the path component to check
+ */
+extern int git_path_is_ntfs_dotgit_ignore(const char *name);
+
+/**
+ * Check whether a path component corresponds to a .gitignore file in HFS+
+ *
+ * @param name the path component to check
+ */
+extern int git_path_is_hfs_dotgit_ignore(const char *name);
+
+/**
* Check whether a path component corresponds to a .gitignore file
*
* @param name the path component to check
*/
extern int git_path_is_dotgit_attributes(const char *name);
+/**
+ * Check whether a path component corresponds to a .gitattributes file in NTFS
+ *
+ * @param name the path component to check
+ */
+extern int git_path_is_ntfs_dotgit_attributes(const char *name);
+
+/**
+ * Check whether a path component corresponds to a .gitattributes file in HFS+
+ *
+ * @param name the path component to check
+ */
+extern int git_path_is_hfs_dotgit_attributes(const char *name);
+
#endif