summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
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