~ubuntu-branches/ubuntu/vivid/gitg/vivid

« back to all changes in this revision

Viewing changes to debian/patches/0002-Initial-patch-to-show-tags-referenced-from-tag-objec.patch

  • Committer: Bazaar Package Importer
  • Author(s): Jonny Lamb
  • Date: 2009-04-09 00:44:07 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090409004407-xl4cwh7yk5tfbiq4
Tags: 0.0.2-1
* New upstream release. (Closes: #522919)
  + Timestamp to date string conversion is now valid UTF-8. (Closes: #518705)
  + Fixes to async task cancellation. (Closes: #520922)
* debian/control: Changed Section to vcs.
* debian/patches/:
  + 0001-Change-Categories-to-Development-RevisionControl.patch: Added
    to change Categories to Development;RevisionControl. (Closes: 520887)
  + 0001-Terminate-gtk_text_buffer_create_tag-s-arguments-wit.patch: Removed
    as applied upstream.
  + 0002-Initial-patch-to-show-tags-referenced-from-tag-objec.patch: Added
    to show tags referenced from tag objects. (Closes: #521062)
* debian/watch: Added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From fe3f3b36f4b15d7c43368f28f7817b84829bedaf Mon Sep 17 00:00:00 2001
 
2
From: Jonny Lamb <jonny@debian.org>
 
3
Date: Tue, 24 Mar 2009 19:31:14 +0000
 
4
Subject: [PATCH 2/2] Initial patch to show tags referenced from tag objects.
 
5
 
 
6
Signed-off-by: Jonny Lamb <jonny@debian.org>
 
7
---
 
8
 gitg/gitg-ref.c        |   43 ++++++++++++++++++++++++++++++++++++++++++-
 
9
 gitg/gitg-ref.h        |    4 +++-
 
10
 gitg/gitg-repository.c |    2 +-
 
11
 gitg/gitg-repository.h |    3 ++-
 
12
 4 files changed, 48 insertions(+), 4 deletions(-)
 
13
 
 
14
diff --git a/gitg/gitg-ref.c b/gitg/gitg-ref.c
 
15
index f681893..81d71fb 100644
 
16
--- a/gitg/gitg-ref.c
 
17
+++ b/gitg/gitg-ref.c
 
18
@@ -30,8 +30,46 @@ typedef struct
 
19
        GitgRefType type;
 
20
 } PrefixTypeMap;
 
21
 
 
22
+static void
 
23
+set_commit_hash(GitgRef *ref, GitgRepository *repo, gchar *sha1)
 
24
+{
 
25
+       gchar **out = gitg_repository_command_with_outputv (repo, NULL, "cat-file", "tag", sha1, NULL);
 
26
+
 
27
+       if (out != NULL && g_str_has_prefix (*out, "object"))
 
28
+       {
 
29
+               gchar **components = g_strsplit(*out, " ", 2);
 
30
+
 
31
+               if (g_strv_length(components) == 2)
 
32
+               {
 
33
+                       gitg_utils_sha1_to_hash(components[1], ref->hash);
 
34
+               }
 
35
+
 
36
+               g_strfreev (components);
 
37
+       }
 
38
+
 
39
+       g_strfreev (out);
 
40
+}
 
41
+
 
42
+static void
 
43
+find_tag_ref(GitgRef *ref, GitgRepository *repo)
 
44
+{
 
45
+       gchar *sha1 = gitg_utils_hash_to_sha1_new(ref->hash);
 
46
+       gchar **out = gitg_repository_command_with_outputv (repo, NULL, "cat-file", "-t", sha1, NULL);
 
47
+
 
48
+       if (out != NULL && g_strv_length (out) == 1)
 
49
+       {
 
50
+               if (g_strcmp0 (*out, "tag") == 0)
 
51
+               {
 
52
+                       set_commit_hash (ref, repo, sha1);
 
53
+               }
 
54
+       }
 
55
+
 
56
+       g_free (sha1);
 
57
+       g_strfreev (out);
 
58
+}
 
59
+
 
60
 GitgRef *
 
61
-gitg_ref_new(gchar const *hash, gchar const *name)
 
62
+gitg_ref_new(GitgRepository *repo, gchar const *hash, gchar const *name)
 
63
 {
 
64
        GitgRef *inst = g_slice_new0(GitgRef);
 
65
 
 
66
@@ -61,6 +99,9 @@ gitg_ref_new(gchar const *hash, gchar const *name)
 
67
                inst->type = GITG_REF_TYPE_NONE;
 
68
                inst->shortname = g_strdup(name);
 
69
        }
 
70
+
 
71
+       if (inst->type == GITG_REF_TYPE_TAG)
 
72
+               find_tag_ref (inst, repo);
 
73
        
 
74
        return inst;
 
75
 }
 
76
diff --git a/gitg/gitg-ref.h b/gitg/gitg-ref.h
 
77
index 32adae7..3d5ae01 100644
 
78
--- a/gitg/gitg-ref.h
 
79
+++ b/gitg/gitg-ref.h
 
80
@@ -41,7 +41,9 @@ typedef struct
 
81
        gchar *shortname;
 
82
 } GitgRef;
 
83
 
 
84
-GitgRef *gitg_ref_new(gchar const *hash, gchar const *name);
 
85
+#include "gitg-repository.h"
 
86
+
 
87
+GitgRef *gitg_ref_new(GitgRepository *repo, gchar const *hash, gchar const *name);
 
88
 void gitg_ref_free(GitgRef *ref);
 
89
 GitgRef *gitg_ref_copy(GitgRef *ref);
 
90
 
 
91
diff --git a/gitg/gitg-repository.c b/gitg/gitg-repository.c
 
92
index f7b9a64..2b88459 100644
 
93
--- a/gitg/gitg-repository.c
 
94
+++ b/gitg/gitg-repository.c
 
95
@@ -639,7 +639,7 @@ gitg_repository_get_loader(GitgRepository *self)
 
96
 static GitgRef *
 
97
 add_ref(GitgRepository *self, gchar const *sha1, gchar const *name)
 
98
 {
 
99
-       GitgRef *ref = gitg_ref_new(sha1, name);
 
100
+       GitgRef *ref = gitg_ref_new(self, sha1, name);
 
101
        GSList *refs = (GSList *)g_hash_table_lookup(self->priv->refs, ref->hash);
 
102
        
 
103
        if (refs == NULL)
 
104
diff --git a/gitg/gitg-repository.h b/gitg/gitg-repository.h
 
105
index 4fc5eb5..3262d5a 100644
 
106
--- a/gitg/gitg-repository.h
 
107
+++ b/gitg/gitg-repository.h
 
108
@@ -26,7 +26,6 @@
 
109
 
 
110
 #include "gitg-revision.h"
 
111
 #include "gitg-runner.h"
 
112
-#include "gitg-ref.h"
 
113
 
 
114
 G_BEGIN_DECLS
 
115
 
 
116
@@ -62,6 +61,8 @@ struct _GitgRepositoryClass
 
117
        void (*load) (GitgRepository *);
 
118
 };
 
119
 
 
120
+#include "gitg-ref.h"
 
121
+
 
122
 GType gitg_repository_get_type (void) G_GNUC_CONST;
 
123
 GitgRepository *gitg_repository_new(gchar const *path);
 
124
 gchar const *gitg_repository_get_path(GitgRepository *repository);