summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
Unidiff
Diffstat (limited to 'ui-shared.c') (more/less context) (show whitespace changes)
-rw-r--r--ui-shared.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 3e378a4..ca2ee82 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -250,4 +250,28 @@ void cgit_diff_link(char *name, char *title, char *class, char *head,
250} 250}
251 251
252void cgit_object_link(struct object *obj)
253{
254 char *page, *arg, *url;
255
256 if (obj->type == OBJ_COMMIT) {
257 cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL,
258 cgit_query_head, sha1_to_hex(obj->sha1));
259 return;
260 } else if (obj->type == OBJ_TREE) {
261 page = "tree";
262 arg = "id";
263 } else {
264 page = "blob";
265 arg = "id";
266 }
267
268 url = cgit_pageurl(cgit_query_repo, page,
269 fmt("%s=%s", arg, sha1_to_hex(obj->sha1)));
270 html_link_open(url, NULL, NULL);
271 htmlf("%s %s", typename(obj->type),
272 sha1_to_hex(obj->sha1));
273 html_link_close();
274}
275
252void cgit_print_date(time_t secs, char *format) 276void cgit_print_date(time_t secs, char *format)
253{ 277{