[libgit2-glib] Bind ggit_branch_is_head



commit ffdc5fd88f1e6a614c17119517ed0809cfbdb75d
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri Mar 15 16:36:50 2013 +0100

    Bind ggit_branch_is_head

 libgit2-glib/ggit-branch.c |   25 +++++++++++++++++++++++++
 libgit2-glib/ggit-branch.h |    3 +++
 2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-branch.c b/libgit2-glib/ggit-branch.c
index 2da9eeb..d56f000 100644
--- a/libgit2-glib/ggit-branch.c
+++ b/libgit2-glib/ggit-branch.c
@@ -176,6 +176,31 @@ ggit_branch_get_tracking (GgitBranch  *branch,
        return _ggit_branch_wrap (tracking);
 }
 
+/**
+ * ggit_branch_is_head:
+ * @branch: a #GgitBranch.
+ * @error: a #GError for error reporting, or %NULL.
+ *
+ * Determines if the current local branch is pointed at by HEAD.
+ *
+ * Returns: %TRUE if the current local branch is pointed at by HEAD.
+ */
+gboolean
+ggit_branch_is_head (GgitBranch  *branch,
+                     GError     **error)
+{
+       gint ret;
 
+       g_return_val_if_fail (GGIT_IS_BRANCH (branch), FALSE);
+
+       ret = git_branch_is_head (_ggit_native_get (branch));
+
+       if (ret > 1)
+       {
+               _ggit_error_set (error, ret);
+       }
+
+       return (ret == 0);
+}
 
 /* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-branch.h b/libgit2-glib/ggit-branch.h
index 7ff4e39..c628b18 100644
--- a/libgit2-glib/ggit-branch.h
+++ b/libgit2-glib/ggit-branch.h
@@ -67,6 +67,9 @@ const gchar        *ggit_branch_get_name           (GgitBranch       *branch,
 GgitBranch         *ggit_branch_get_tracking       (GgitBranch       *branch,
                                                     GError          **error);
 
+gboolean            ggit_branch_is_head            (GgitBranch       *branch,
+                                                    GError          **error);
+
 G_END_DECLS
 
 #endif /* __GGIT_BRANCH_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]