summaryrefslogtreecommitdiff
path: root/include/git2/repository.h
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-09-15 22:07:45 +0200
committernulltoken <emeric.fermas@gmail.com>2012-09-17 10:48:35 +0200
commit44af67a8b6679ac33c3407d45fee042178d97e76 (patch)
treed4672e92baa544a82adbc2b050b09d2ef71c6a9b /include/git2/repository.h
parent4ebe38bd589b7b99427b2822ca7a486c8bb3bf02 (diff)
downloadlibgit2-44af67a8b6679ac33c3407d45fee042178d97e76.tar.gz
repository: introduce git_repository_set_head()
Diffstat (limited to 'include/git2/repository.h')
-rw-r--r--include/git2/repository.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h
index 59a7d2c98..025a0a95d 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -507,6 +507,28 @@ GIT_EXTERN(int) git_repository_hashfile(
const char *as_path);
/**
+ * Make the repository HEAD point to the specified reference.
+ *
+ * If the provided reference points to a Tree or a Blob, the HEAD is
+ * unaltered and -1 is returned.
+ *
+ * If the provided reference points to a branch, the HEAD will point
+ * to that branch, staying attached, or become attached if it isn't yet.
+ * If the branch doesn't exist yet, no error will be return. The HEAD
+ * will then be attached to an unborn branch.
+ *
+ * Otherwise, the HEAD will be detached and will directly point to
+ * the Commit.
+ *
+ * @param repo Repository pointer
+ * @param refname Canonical name of the reference the HEAD should point at
+ * @return 0 on success, or an error code
+ */
+GIT_EXTERN(int) git_repository_set_head(
+ git_repository* repo,
+ const char* refname);
+
+/**
* Make the repository HEAD directly point to the Commit.
*
* If the provided committish cannot be found in the repository, the HEAD