[libgit2-glib] Bind ggit_ref_get_remote_tracking_from_branch
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Bind ggit_ref_get_remote_tracking_from_branch
- Date: Thu, 12 Jul 2012 18:04:46 +0000 (UTC)
commit ccea9edd96664403a6a27d7e1a12b62b04df2dca
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu Jul 12 20:05:55 2012 +0200
Bind ggit_ref_get_remote_tracking_from_branch
libgit2-glib/ggit-ref.c | 34 ++++++++++++++++++++++++++++++++++
libgit2-glib/ggit-ref.h | 4 ++++
2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-ref.c b/libgit2-glib/ggit-ref.c
index 336d29c..97190e4 100644
--- a/libgit2-glib/ggit-ref.c
+++ b/libgit2-glib/ggit-ref.c
@@ -491,4 +491,38 @@ ggit_ref_delete_reflog (GgitRef *ref,
}
}
+/**
+ * ggit_ref_get_remote_tracking_from_branch:
+ * @ref: a #GgitRef.
+ * @error: a #GError for error reporting, or %NULL.
+ *
+ * Gets the reference supporting the remote tracking branch,
+ * given a reference branch. The input reference has to be located
+ * in the `refs/heads` namespace. If the remote tracking reference does not
+ * exits the error will be set to %GGIT_ERROR_NOTFOUND.
+ *
+ * Returns: (transfer full): the reference supporting the remote tracking branch,
+ * given a reference branch or %NULL on error.
+ */
+GgitRef *
+ggit_ref_get_remote_tracking_from_branch (GgitRef *ref,
+ GError **error)
+{
+ git_reference *reference;
+ gint ret;
+
+ g_return_val_if_fail (GGIT_IS_REF (ref), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ ret = git_reference_remote_tracking_from_branch (&reference, _ggit_native_get (ref));
+
+ if (ret != GIT_OK)
+ {
+ _ggit_error_set (error, ret);
+ return NULL;
+ }
+
+ return _ggit_ref_wrap (reference);
+}
+
/* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-ref.h b/libgit2-glib/ggit-ref.h
index cde371f..6f356cf 100644
--- a/libgit2-glib/ggit-ref.h
+++ b/libgit2-glib/ggit-ref.h
@@ -106,6 +106,10 @@ void ggit_ref_rename_reflog (GgitRef *ref,
void ggit_ref_delete_reflog (GgitRef *ref,
GError **error);
+GgitRef *ggit_ref_get_remote_tracking_from_branch
+ (GgitRef *ref,
+ GError **error);
+
G_END_DECLS
#endif /* __GGIT_REF_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]