summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorRomain Geissler <romain.geissler@gmail.com>2011-06-04 01:01:20 +0200
committerRomain Geissler <romain.geissler@gmail.com>2011-06-04 01:05:36 +0200
commitfd0574e5ad4e2e5924ff0d0869da7d5846225d8b (patch)
tree80bac37a285b324014fa38b5abd40af5972d53a5 /include/git2
parent222cf1d45992d746716c10808911e2996c650182 (diff)
downloadlibgit2-fd0574e5ad4e2e5924ff0d0869da7d5846225d8b.tar.gz
Repository: Added the git_repository_discover function that finds by itself the git directory that manage a given directory path.
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/repository.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h
index 493e82ad5..4a7303e68 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -133,6 +133,34 @@ GIT_EXTERN(int) git_repository_open3(git_repository **repository,
const char *git_work_tree);
/**
+ * Look for a git repository and copy its path in the given buffer. The lookup start
+ * from base_path and walk across parent directories if nothing has been found. The
+ * lookup ends when the first repository is found, or when reaching a directory
+ * referenced in ceiling_dirs or when the filesystem changes (in case across_fs
+ * is true).
+ *
+ * The method will automatically detect if the repository is bare (if there is
+ * a repository).
+ *
+ * @param repository_path The user allocated buffer which will contain the found path.
+ *
+ * @param size repository_path size
+ *
+ * @param start_path The base path where the lookup starts.
+ *
+ * @param across_fs If true, then the lookup will not stop when a filesystem device change
+ * is detected while exploring parent directories.
+ *
+ * @param ceiling_dirs A colon separated of absolute symbolic link free paths. The lookup will
+ * stop when any of this paths is reached. Note that the lookup always performs on start_path
+ * no matter start_path appears in ceiling_dirs
+ * ceiling_dirs might be NULL (which is equivalent to an empty string)
+ *
+ * @return 0 on success; error code otherwise
+ */
+GIT_EXTERN(int) git_repository_discover(char *repository_path, size_t size, const char *start_path, int across_fs, const char *ceiling_dirs);
+
+/**
* Get the object database behind a Git repository
*
* @param repo a repository object