diff options
author | Lars Hjemli <hjemli@gmail.com> | 2007-07-23 06:42:55 (JST) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-07-23 06:44:57 (JST) |
commit | 4e9107abfe8d3edff17826875b417bcf40dc7390 (patch) | |
tree | 96cfafa9b8838f34e1363ee3019eae64a6229b30 /ui-shared.c | |
parent | 71ebcbe23ab548e5c0ad40aa8be5741654ed3201 (diff) | |
download | cgit-4e9107abfe8d3edff17826875b417bcf40dc7390.zip cgit-4e9107abfe8d3edff17826875b417bcf40dc7390.tar.gz |
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>
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index d4376ce..fd71c12 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -218,6 +218,30 @@ void cgit_diff_link(char *name, char *title, char *class, char *head, | |||
218 | html("</a>"); | 218 | html("</a>"); |
219 | } | 219 | } |
220 | 220 | ||
221 | void cgit_object_link(struct object *obj) | ||
222 | { | ||
223 | char *page, *arg, *url; | ||
224 | |||
225 | if (obj->type == OBJ_COMMIT) { | ||
226 | cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL, | ||
227 | cgit_query_head, sha1_to_hex(obj->sha1)); | ||
228 | return; | ||
229 | } else if (obj->type == OBJ_TREE) { | ||
230 | page = "tree"; | ||
231 | arg = "id"; | ||
232 | } else { | ||
233 | page = "blob"; | ||
234 | arg = "id"; | ||
235 | } | ||
236 | |||
237 | url = cgit_pageurl(cgit_query_repo, page, | ||
238 | fmt("%s=%s", arg, sha1_to_hex(obj->sha1))); | ||
239 | html_link_open(url, NULL, NULL); | ||
240 | htmlf("%s %s", typename(obj->type), | ||
241 | sha1_to_hex(obj->sha1)); | ||
242 | html_link_close(); | ||
243 | } | ||
244 | |||
221 | void cgit_print_date(time_t secs, char *format) | 245 | void cgit_print_date(time_t secs, char *format) |
222 | { | 246 | { |
223 | char buf[64]; | 247 | char buf[64]; |