summaryrefslogtreecommitdiff
path: root/src/path.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2018-10-15 13:54:17 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2018-10-15 13:54:17 +0200
commit05e54e006b84f1a18dffd0a15f750f2792b2b8f9 (patch)
tree464a2b36117a0ed4e01e7fde9ebdb2769c8c0067 /src/path.h
parent814e7acbabc2e756f809057b7746e08839c44cde (diff)
downloadlibgit2-05e54e006b84f1a18dffd0a15f750f2792b2b8f9.tar.gz
path: export the dotgit-checking functionscmn/expose-gitfile-check
These checks are preformed by libgit2 on checkout, but they're also useful for performing checks in applications which do not involve checkout. Expose them under `sys/` as it's still fairly in the weeds even for this library.
Diffstat (limited to 'src/path.h')
-rw-r--r--src/path.h40
1 files changed, 2 insertions, 38 deletions
diff --git a/src/path.h b/src/path.h
index fb41f960f..e29a7f6b3 100644
--- a/src/path.h
+++ b/src/path.h
@@ -13,6 +13,8 @@
#include "buffer.h"
#include "vector.h"
+#include "git2/sys/path.h"
+
/**
* Path manipulation utils
*
@@ -645,42 +647,4 @@ extern bool git_path_isvalid(
*/
int git_path_normalize_slashes(git_buf *out, const char *path);
-/*
- * The order needs to stay the same to not break the `gitfiles`
- * array in path.c
- */
-typedef enum {
- GIT_PATH_GITFILE_GITIGNORE,
- GIT_PATH_GITFILE_GITMODULES,
- GIT_PATH_GITFILE_GITATTRIBUTES
-} git_path_gitfile;
-
-typedef enum {
- /* Do both NTFS- and HFS-specific checks */
- GIT_PATH_FS_GENERIC,
- /* Do NTFS-specific checks only */
- GIT_PATH_FS_NTFS,
- /* Do HFS-specific checks only */
- GIT_PATH_FS_HFS
-} git_path_fs;
-
-/**
- * Check whether a path component corresponds to a .git$SUFFIX
- * file.
- *
- * As some filesystems do special things to filenames when
- * writing files to disk, you cannot always do a plain string
- * comparison to verify whether a file name matches an expected
- * path or not. This function can do the comparison for you,
- * depending on the filesystem you're on.
- *
- * @param path the path component to check
- * @param pathlen the length of `path` that is to be checked
- * @param gitfile which file to check against
- * @param fs which filesystem-specific checks to use
- * @return 0 in case the file does not match, a positive value if
- * it does; -1 in case of an error
- */
-extern int git_path_is_gitfile(const char *path, size_t pathlen, git_path_gitfile gitfile, git_path_fs fs);
-
#endif