author | Lars Hjemli <hjemli@gmail.com> | 2007-07-22 21:42:55 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-07-22 21:44:57 (UTC) |
commit | 4e9107abfe8d3edff17826875b417bcf40dc7390 (patch) (unidiff) | |
tree | 96cfafa9b8838f34e1363ee3019eae64a6229b30 /ui-summary.c | |
parent | 71ebcbe23ab548e5c0ad40aa8be5741654ed3201 (diff) | |
download | cgit-4e9107abfe8d3edff17826875b417bcf40dc7390.zip cgit-4e9107abfe8d3edff17826875b417bcf40dc7390.tar.gz cgit-4e9107abfe8d3edff17826875b417bcf40dc7390.tar.bz2 |
Add ui-tag.c
This file implements the tag-command, i.e. printing of annotated tags.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-summary.c | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/ui-summary.c b/ui-summary.c index b4bc6d8..de8a180 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -47,31 +47,6 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, | |||
47 | return 0; | 47 | return 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | |||
51 | static void cgit_print_object_ref(struct object *obj) | ||
52 | { | ||
53 | char *page, *arg, *url; | ||
54 | |||
55 | if (obj->type == OBJ_COMMIT) { | ||
56 | cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL, | ||
57 | cgit_query_head, sha1_to_hex(obj->sha1)); | ||
58 | return; | ||
59 | } else if (obj->type == OBJ_TREE) { | ||
60 | page = "tree"; | ||
61 | arg = "id"; | ||
62 | } else { | ||
63 | page = "view"; | ||
64 | arg = "id"; | ||
65 | } | ||
66 | |||
67 | url = cgit_pageurl(cgit_query_repo, page, | ||
68 | fmt("%s=%s", arg, sha1_to_hex(obj->sha1))); | ||
69 | html_link_open(url, NULL, NULL); | ||
70 | htmlf("%s %s", typename(obj->type), | ||
71 | sha1_to_hex(obj->sha1)); | ||
72 | html_link_close(); | ||
73 | } | ||
74 | |||
75 | static void print_tag_header() | 50 | static void print_tag_header() |
76 | { | 51 | { |
77 | html("<tr class='nohover'><th class='left'>Tag</th>" | 52 | html("<tr class='nohover'><th class='left'>Tag</th>" |
@@ -100,8 +75,8 @@ static int cgit_print_tag_cb(const char *refname, const unsigned char *sha1, | |||
100 | if (!header) | 75 | if (!header) |
101 | print_tag_header(); | 76 | print_tag_header(); |
102 | html("<tr><td>"); | 77 | html("<tr><td>"); |
103 | url = cgit_pageurl(cgit_query_repo, "view", | 78 | url = cgit_pageurl(cgit_query_repo, "tag", |
104 | fmt("id=%s", sha1_to_hex(sha1))); | 79 | fmt("id=%s", refname)); |
105 | html_link_open(url, NULL, NULL); | 80 | html_link_open(url, NULL, NULL); |
106 | html_txt(buf); | 81 | html_txt(buf); |
107 | html_link_close(); | 82 | html_link_close(); |
@@ -112,7 +87,7 @@ static int cgit_print_tag_cb(const char *refname, const unsigned char *sha1, | |||
112 | if (info->tagger) | 87 | if (info->tagger) |
113 | html(info->tagger); | 88 | html(info->tagger); |
114 | html("</td><td>"); | 89 | html("</td><td>"); |
115 | cgit_print_object_ref(tag->tagged); | 90 | cgit_object_link(tag->tagged); |
116 | html("</td></tr>\n"); | 91 | html("</td></tr>\n"); |
117 | } else { | 92 | } else { |
118 | if (!header) | 93 | if (!header) |
@@ -120,7 +95,7 @@ static int cgit_print_tag_cb(const char *refname, const unsigned char *sha1, | |||
120 | html("<tr><td>"); | 95 | html("<tr><td>"); |
121 | html_txt(buf); | 96 | html_txt(buf); |
122 | html("</td><td colspan='2'/><td>"); | 97 | html("</td><td colspan='2'/><td>"); |
123 | cgit_print_object_ref(obj); | 98 | cgit_object_link(obj); |
124 | html("</td></tr>\n"); | 99 | html("</td></tr>\n"); |
125 | } | 100 | } |
126 | return 0; | 101 | return 0; |