summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-06-28 13:55:00 +0200
committerCarlos Martín Nieto <cmn@elego.de>2011-06-28 16:59:51 +0200
commit35502d2ec420fe2e58e79b653e44aa4a16300d30 (patch)
tree1ad2e3acf46f5339bafd4f312e63baf14cf4461b /include/git2
parent0b10c9ea6ef5d85d862edd044d96561c4fd16e9b (diff)
downloadlibgit2-35502d2ec420fe2e58e79b653e44aa4a16300d30.tar.gz
Add git_repository_is_detached, git_repository_is_orphan
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/repository.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h
index 27c3138f7..ddadab4da 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -219,6 +219,30 @@ GIT_EXTERN(void) git_repository_free(git_repository *repo);
GIT_EXTERN(int) git_repository_init(git_repository **repo_out, const char *path, unsigned is_bare);
/**
+ * Check if a repository's HEAD is detached
+ *
+ * A repository's HEAD is detached when it points directly to a commit
+ * instead of a branch.
+ *
+ * @param repo Repo to test
+ * @return 1 if HEAD is detached, 0 if i'ts not; error code if there
+ * was an error.
+ */
+int git_repository_is_detached(git_repository *repo);
+
+/**
+ * Check if the current branch is an orphan
+ *
+ * An orphan branch is one named from HEAD but which doesn't exist in
+ * the refs namespace, because it doesn't have any commit to point to.
+ *
+ * @param repo Repo to test
+ * @return 1 if the current branch is an orphan, 0 if it's not; error
+ * code if therewas an error
+ */
+int git_repository_is_orphan(git_repository *repo);
+
+/**
* Check if a repository is empty
*
* An empty repository has just been initialized and contains