[libgit2-glib] Make the submodule api to build again.



commit 4d692c0d8fbd916382196aabaf4682074f8d6663
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sat Sep 29 12:53:17 2012 +0200

    Make the submodule api to build again.
    
    See that we still need to add the missing api, update the docs
    and fix the foreach_submodule as it seems inconsistent with
    the rest of the API. I sent a mail to the list asking for
    help on this issue.

 libgit2-glib/ggit-repository.c |    4 ++++
 libgit2-glib/ggit-submodule.c  |   29 ++++++++++++++++++-----------
 libgit2-glib/ggit-submodule.h  |    2 +-
 3 files changed, 23 insertions(+), 12 deletions(-)
---
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index 5de2679..f8757e9 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -1535,6 +1535,8 @@ ggit_repository_lookup_submodule (GgitRepository  *repository,
 	return gsubmodule;
 }
 
+#if 0
+
 /**
  * ggit_repository_submodule_foreach:
  * @repository: a #GgitRepository.
@@ -1575,6 +1577,8 @@ ggit_repository_submodule_foreach (GgitRepository        *repository,
 	return TRUE;
 }
 
+#endif
+
 /**
  * ggit_repository_reset:
  * @repository: a #GgitRepository.
diff --git a/libgit2-glib/ggit-submodule.c b/libgit2-glib/ggit-submodule.c
index 806b406..18c8e4c 100644
--- a/libgit2-glib/ggit-submodule.c
+++ b/libgit2-glib/ggit-submodule.c
@@ -92,7 +92,7 @@ ggit_submodule_get_name (GgitSubmodule *submodule)
 {
 	g_return_val_if_fail (submodule != NULL, NULL);
 
-	return submodule->submodule->name;
+	return git_submodule_name (submodule->submodule);
 }
 
 /**
@@ -110,7 +110,7 @@ ggit_submodule_get_path (GgitSubmodule *submodule)
 {
 	g_return_val_if_fail (submodule != NULL, NULL);
 
-	return submodule->submodule->path;
+	return git_submodule_path (submodule->submodule);
 }
 
 /**
@@ -127,23 +127,30 @@ ggit_submodule_get_url (GgitSubmodule *submodule)
 {
 	g_return_val_if_fail (submodule != NULL, NULL);
 
-	return submodule->submodule->url;
+	return git_submodule_url (submodule->submodule);
 }
 
 /**
- * ggit_submodule_get_oid:
+ * ggit_submodule_get_index_oid:
  * @submodule: a #GgitSubmodule.
  *
- * Gets the HEAD SHA1 for the submodule or zero if not committed.
+ * Gets the OID for the submodule in the index or %NULL if there is no index.
  *
- * Returns: (transfer full): the HEAD SHA1 for the submodule.
+ * Returns: (transfer full) (allow-none): the OID for the submodule in the index or %NULL.
  */
 GgitOId *
-ggit_submodule_get_oid (GgitSubmodule *submodule)
+ggit_submodule_get_index_oid (GgitSubmodule *submodule)
 {
+	GgitOID *oid = NULL;
+
 	g_return_val_if_fail (submodule != NULL, NULL);
 
-	return _ggit_oid_new (&submodule->submodule->oid);
+	if (git_submodule_index_oid (submodule->submodule))
+	{
+		oid = _ggit_oid_new (git_submodule_index_oid (submodule->submodule));
+	}
+
+	return oid;
 }
 
 /**
@@ -159,7 +166,7 @@ ggit_submodule_get_update (GgitSubmodule *submodule)
 {
 	g_return_val_if_fail (submodule != NULL, 0);
 
-	return submodule->submodule->update;
+	return git_submodule_update (submodule->submodule);
 }
 
 /**
@@ -175,7 +182,7 @@ ggit_submodule_get_ignore (GgitSubmodule *submodule)
 {
 	g_return_val_if_fail (submodule != NULL, 0);
 
-	return submodule->submodule->ignore;
+	return git_submodule_ignore (submodule->submodule);
 }
 
 /**
@@ -191,7 +198,7 @@ ggit_submodule_get_fetch_recurse (GgitSubmodule *submodule)
 {
 	g_return_val_if_fail (submodule != NULL, FALSE);
 
-	return submodule->submodule->fetch_recurse;
+	return git_submodule_fetch_recurse_submodules (submodule->submodule);
 }
 
 /* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-submodule.h b/libgit2-glib/ggit-submodule.h
index f435cf9..600d9ed 100644
--- a/libgit2-glib/ggit-submodule.h
+++ b/libgit2-glib/ggit-submodule.h
@@ -44,7 +44,7 @@ const gchar            *ggit_submodule_get_path              (GgitSubmodule
 
 const gchar            *ggit_submodule_get_url               (GgitSubmodule       *submodule);
 
-GgitOId                *ggit_submodule_get_oid               (GgitSubmodule       *submodule);
+GgitOId                *ggit_submodule_get_index_oid         (GgitSubmodule       *submodule);
 
 GgitSubmoduleUpdate     ggit_submodule_get_update            (GgitSubmodule       *submodule);
 



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