[libgit2-glib] Fix to build against latest libgit2



commit 31fe78baa72a76d7b0942d82e6ed8667c99f0f76
Author: Garrett Regier <garrettregier gmail com>
Date:   Mon Jul 30 02:51:09 2012 -0700

    Fix to build against latest libgit2

 libgit2-glib/ggit-ref.c        |   11 ++++++-----
 libgit2-glib/ggit-repository.c |   21 ++++++++++-----------
 libgit2-glib/ggit-repository.h |    4 ++--
 3 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/libgit2-glib/ggit-ref.c b/libgit2-glib/ggit-ref.c
index 97190e4..b8a44f7 100644
--- a/libgit2-glib/ggit-ref.c
+++ b/libgit2-glib/ggit-ref.c
@@ -26,6 +26,7 @@
 #include "ggit-signature.h"
 #include "ggit-utils.h"
 
+#include <git2/branch.h>
 #include <git2/errors.h>
 
 G_DEFINE_TYPE (GgitRef, ggit_ref, GGIT_TYPE_NATIVE)
@@ -426,10 +427,10 @@ ggit_ref_create_reflog (GgitRef        *ref,
 	g_return_val_if_fail (message != NULL && *message != '\0', NULL);
 	g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
-	ret = git_reflog_write (_ggit_native_get (ref),
-	                        _ggit_native_get (oid),
-	                        _ggit_native_get (committer),
-	                        message);
+	ret = git_reflog_append (_ggit_native_get (ref),
+	                         _ggit_native_get (oid),
+	                         _ggit_native_get (committer),
+	                         message);
 
 	if (ret != GIT_OK)
 	{
@@ -514,7 +515,7 @@ ggit_ref_get_remote_tracking_from_branch (GgitRef  *ref,
 	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));
+	ret = git_branch_tracking (&reference, _ggit_native_get (ref));
 
 	if (ret != GIT_OK)
 	{
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index 628bc27..820fcfb 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -1267,10 +1267,10 @@ ggit_repository_list_tags (GgitRepository  *repository,
  *
  * Creates a new branch pointing at a target commit.
  *
- * Returns: (transfer full) (allow-none): the id to which the branch points, or
- *                                        %NULL in case of an error.
+ * Returns: (transfer full) (allow-none): the reference to which the branch
+ *                                        points, or %NULL in case of an error.
  **/
-GgitOId *
+GgitRef *
 ggit_repository_create_branch (GgitRepository   *repository,
                                const gchar      *branch_name,
                                GgitObject       *target,
@@ -1278,7 +1278,7 @@ ggit_repository_create_branch (GgitRepository   *repository,
                                GError          **error)
 {
 	gboolean force;
-	git_oid oid;
+	git_reference *reference;
 	gint ret;
 
 	g_return_val_if_fail (GGIT_IS_REPOSITORY (repository), FALSE);
@@ -1288,7 +1288,7 @@ ggit_repository_create_branch (GgitRepository   *repository,
 
 	force = flags & GGIT_CREATE_FORCE;
 
-	ret = git_branch_create (&oid,
+	ret = git_branch_create (&reference,
 	                         _ggit_native_get (repository),
 	                         branch_name,
 	                         _ggit_native_get (target),
@@ -1300,7 +1300,7 @@ ggit_repository_create_branch (GgitRepository   *repository,
 		return NULL;
 	}
 
-	return _ggit_oid_new (&oid);
+	return _ggit_ref_wrap (reference);
 }
 
 /**
@@ -1337,7 +1337,7 @@ ggit_repository_delete_branch (GgitRepository   *repository,
 /**
  * ggit_repository_move_branch:
  * @repository: a #GgitRepository.
- * @old_branch_name: the old name of the branch.
+ * @branch: the #GgitRef for the branch.
  * @new_branch_name: the new name of the branch.
  * @flags: a GgitCreateFlags.
  * @error: a #GError.
@@ -1346,7 +1346,7 @@ ggit_repository_delete_branch (GgitRepository   *repository,
  **/
 void
 ggit_repository_move_branch (GgitRepository   *repository,
-                             const gchar      *old_branch_name,
+                             GgitRef          *branch,
                              const gchar      *new_branch_name,
                              GgitCreateFlags   flags,
                              GError          **error)
@@ -1355,14 +1355,13 @@ ggit_repository_move_branch (GgitRepository   *repository,
 	gint ret;
 
 	g_return_if_fail (GGIT_IS_REPOSITORY (repository));
-	g_return_if_fail (old_branch_name != NULL);
+	g_return_if_fail (GGIT_IS_REF (branch));
 	g_return_if_fail (new_branch_name != NULL);
 	g_return_if_fail (error == NULL || *error == NULL);
 
 	force = flags & GGIT_CREATE_FORCE;
 
-	ret = git_branch_move (_ggit_native_get (repository),
-	                       old_branch_name,
+	ret = git_branch_move (_ggit_native_get (branch),
 	                       new_branch_name,
 	                       force ? 1 : 0);
 
diff --git a/libgit2-glib/ggit-repository.h b/libgit2-glib/ggit-repository.h
index f70f0b1..5a20f75 100644
--- a/libgit2-glib/ggit-repository.h
+++ b/libgit2-glib/ggit-repository.h
@@ -120,7 +120,7 @@ GgitOId            *ggit_repository_create_tag_lightweight (
 gchar             **ggit_repository_list_tags         (GgitRepository        *repository,
                                                        GError               **error);
 
-GgitOId            *ggit_repository_create_branch     (GgitRepository        *repository,
+GgitRef            *ggit_repository_create_branch     (GgitRepository        *repository,
                                                        const gchar           *branch_name,
                                                        GgitObject            *target,
                                                        GgitCreateFlags        flags,
@@ -132,7 +132,7 @@ void                ggit_repository_delete_branch     (GgitRepository        *re
                                                        GError               **error);
 
 void                ggit_repository_move_branch       (GgitRepository        *repository,
-                                                       const gchar           *old_branch_name,
+                                                       GgitRef               *branch,
                                                        const gchar           *new_branch_name,
                                                        GgitCreateFlags        flags,
                                                        GError               **error);



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