Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2012-08-19 12:26:06 +0400
committerVicent Martí <vicent@github.com>2012-08-19 12:26:06 +0400
commitf98c32f3fea0d5532db2d5733418aa62648b9e93 (patch)
tree5b53901f1848d73a72765ec014e2ad5188316eb4 /src/path.h
parent1a10fded40875f986164b80c6efd414cd1507cb8 (diff)
parenteb87800ab631d19a7655f01ece130455b1cc976a (diff)
Merge pull request #778 from ben/clone
Clone
Diffstat (limited to 'src/path.h')
-rw-r--r--src/path.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/path.h b/src/path.h
index d611428c1..14618b2fc 100644
--- a/src/path.h
+++ b/src/path.h
@@ -80,7 +80,24 @@ extern int git_path_to_dir(git_buf *path);
*/
extern void git_path_string_to_dir(char* path, size_t size);
+/**
+ * Taken from git.git; returns nonzero if the given path is "." or "..".
+ */
+GIT_INLINE(int) git_path_is_dot_or_dotdot(const char *name)
+{
+ return (name[0] == '.' &&
+ (name[1] == '\0' ||
+ (name[1] == '.' && name[2] == '\0')));
+}
+
#ifdef GIT_WIN32
+GIT_INLINE(int) git_path_is_dot_or_dotdotW(const wchar_t *name)
+{
+ return (name[0] == L'.' &&
+ (name[1] == L'\0' ||
+ (name[1] == L'.' && name[2] == L'\0')));
+}
+
/**
* Convert backslashes in path to forward slashes.
*/
@@ -130,6 +147,11 @@ extern bool git_path_isdir(const char *path);
extern bool git_path_isfile(const char *path);
/**
+ * Check if the given path is a directory, and is empty.
+ */
+extern bool git_path_is_empty_dir(const char *path);
+
+/**
* Stat a file and/or link and set error if needed.
*/
extern int git_path_lstat(const char *path, struct stat *st);