From 4ebe38bd589b7b99427b2822ca7a486c8bb3bf02 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Sat, 15 Sep 2012 22:07:09 +0200 Subject: repository: introduce git_repository_set_head_detached() --- include/git2/repository.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include/git2') 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 @@ -506,6 +506,26 @@ GIT_EXTERN(int) git_repository_hashfile( git_otype type, 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. * -- cgit v1.2.1