summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-09-15 22:03:31 +0200
committernulltoken <emeric.fermas@gmail.com>2012-09-17 10:48:34 +0200
commit3f4c3072ea36877c07380d096d6277e9777f4587 (patch)
treec7ecadd96c222b17963d3524f54cff73270877eb /include/git2
parentcc548c7b0ff0d8b33a44d90316abe0027cb6c7d9 (diff)
downloadlibgit2-3f4c3072ea36877c07380d096d6277e9777f4587.tar.gz
repository: introduce git_repository_detach_head()
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/repository.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h
index a536c1398..e68e0548f 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -506,6 +506,25 @@ GIT_EXTERN(int) git_repository_hashfile(
git_otype type,
const char *as_path);
+/**
+ * Detach the HEAD.
+ *
+ * If the HEAD is already detached and points to a Commit, 0 is returned.
+ *
+ * If the HEAD is already detached and points to a Tag, the HEAD is
+ * updated into making it point to the peeled Commit, and 0 is returned.
+ *
+ * If the HEAD is already detached and points to a non commitish, the HEAD is
+ * unaletered, and -1 is returned.
+ *
+ * Otherwise, the HEAD will be detached and point to the peeled Commit.
+ *
+ * @param repo Repository pointer
+ * @return 0 on success, or an error code
+ */
+GIT_EXTERN(int) git_repository_detach_head(
+ git_repository* repo);
+
/** @} */
GIT_END_DECL
#endif