[gitg] Implemented resolving tag ref objects to actual commits



commit 08fa38e8d586bfc4397f885887a9a5a7052395a3
Author: Jesse van den Kieboom <jvanden grijpc10 epfl ch>
Date:   Mon Apr 20 13:26:34 2009 +0200

    Implemented resolving tag ref objects to actual commits
    
    This makes them show in the history view again. Before, 'real' tag objects did not show up because the refs are checked against commits.
---
 gitg/gitg-repository.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/gitg/gitg-repository.c b/gitg/gitg-repository.c
index 090cff7..ec7a033 100644
--- a/gitg/gitg-repository.c
+++ b/gitg/gitg-repository.c
@@ -737,20 +737,22 @@ load_refs(GitgRepository *self)
 {
 	gchar *current = load_current_ref(self);
 	
-	gchar **refs = gitg_repository_command_with_outputv(self, NULL, "for-each-ref", "--format=%(refname) %(objectname)", "refs", NULL);
+	gchar **refs = gitg_repository_command_with_outputv(self, NULL, "for-each-ref", "--format=%(refname) %(objectname) %(*objectname)", "refs", NULL);
 	gchar **buffer = refs;
 	gchar *buf;
 	
 	while ((buf = *buffer++) != NULL)
 	{
 		// each line will look like <name> <hash>
-		gchar **components = g_strsplit(buf, " ", 2);
+		gchar **components = g_strsplit(buf, " ", 3);
+		guint len = g_strv_length(components);
 		
-		if (g_strv_length(components) == 2)
+		if (len == 2 || len == 3)
 		{
-			GitgRef *ref = add_ref(self, components[1], components[0]);
+			gchar const *obj = len == 3 && *components[2] ? components[2] : components[1];
+			GitgRef *ref = add_ref(self, obj, components[0]);
 			
-			if (current != NULL && strncmp(components[1], current, strlen(current)) == 0)
+			if (current != NULL && strncmp(obj, current, strlen(current)) == 0)
 				self->priv->current_ref = gitg_ref_copy(ref);
 		}
 		



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