[libgit2-glib] Bind ggit_repository_set_head
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Bind ggit_repository_set_head
- Date: Sun, 9 Aug 2015 21:54:10 +0000 (UTC)
commit e900c3ab0309ad9443f258d5972d4ad6ae7a84d5
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Sun Aug 9 23:53:18 2015 +0200
Bind ggit_repository_set_head
libgit2-glib/ggit-repository.c | 31 +++++++++++++++++++++++++++++++
libgit2-glib/ggit-repository.h | 4 ++++
2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index af0df9e..e6453e2 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -907,6 +907,37 @@ ggit_repository_get_head (GgitRepository *repository,
}
/**
+ * ggit_repository_set_head:
+ * @repository: a #GgitRepository.
+ * @ref_name: canonical name of the reference HEAD should point to.
+ * @error: a #GError for error reporting, or %NULL.
+ *
+ * Returns: %TRUE if head was successfully set, %FALSE otherwise.
+ *
+ **/
+gboolean
+ggit_repository_set_head (GgitRepository *repository,
+ const gchar *ref_name,
+ GError **error)
+{
+ gint ret;
+
+ g_return_val_if_fail (GGIT_IS_REPOSITORY (repository), FALSE);
+ g_return_val_if_fail (ref_name != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ ret = git_repository_set_head (_ggit_native_get (repository), ref_name);
+
+ if (ret != GIT_OK)
+ {
+ _ggit_error_set (error, ret);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
* ggit_repository_discover:
* @location: the base location where the lookup starts.
* @error: a #GError for error reporting, or %NULL.
diff --git a/libgit2-glib/ggit-repository.h b/libgit2-glib/ggit-repository.h
index 2c933a1..ace4e18 100644
--- a/libgit2-glib/ggit-repository.h
+++ b/libgit2-glib/ggit-repository.h
@@ -264,6 +264,10 @@ void ggit_repository_add_remote_fetch (GgitRepository *re
GgitRef *ggit_repository_get_head (GgitRepository *repository,
GError **error);
+gboolean ggit_repository_set_head (GgitRepository *repository,
+ const gchar *ref_name,
+ GError **error);
+
GFile *ggit_repository_discover (GFile *location,
GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]