summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-09-15 22:07:09 +0200
committernulltoken <emeric.fermas@gmail.com>2012-09-17 10:48:35 +0200
commit4ebe38bd589b7b99427b2822ca7a486c8bb3bf02 (patch)
treeb1755c3c537790e1dce8c1df5ee7931ad18510cd /include/git2
parent3f4c3072ea36877c07380d096d6277e9777f4587 (diff)
downloadlibgit2-4ebe38bd589b7b99427b2822ca7a486c8bb3bf02.tar.gz
repository: introduce git_repository_set_head_detached()
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/repository.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h
index e68e0548f..59a7d2c98 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -507,6 +507,26 @@ GIT_EXTERN(int) git_repository_hashfile(
const char *as_path);
/**
+ * Make the repository HEAD directly point to the Commit.
+ *
+ * If the provided committish cannot be found in the repository, the HEAD
+ * is unaltered and GIT_ENOTFOUND is returned.
+ *
+ * If the provided commitish cannot be peeled into a commit, the HEAD
+ * is unaltered and -1 is returned.
+ *
+ * Otherwise, the HEAD will eventually be detached and will directly point to
+ * the peeled Commit.
+ *
+ * @param repo Repository pointer
+ * @param commitish Object id of the Commit the HEAD should point to
+ * @return 0 on success, or an error code
+ */
+GIT_EXTERN(int) git_repository_set_head_detached(
+ git_repository* repo,
+ const git_oid* commitish);
+
+/**
* Detach the HEAD.
*
* If the HEAD is already detached and points to a Commit, 0 is returned.