aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
diff options
context:
space:
mode:
authorGravatar Lars Hjemli <hjemli@gmail.com>2008-10-06 04:12:08 (JST)
committerGravatar Lars Hjemli <hjemli@gmail.com>2008-10-06 04:12:08 (JST)
commit8b5fc6de036cf159ffa61a55158044749bd6f4d9 (patch)
treec1accdd309b0af0f17fd97e91b8980185db79b21 /ui-shared.c
parent2e884f3162771880a2a5260713d6b7d1aa25bc6f (diff)
downloadcgit-8b5fc6de036cf159ffa61a55158044749bd6f4d9.zip
cgit-8b5fc6de036cf159ffa61a55158044749bd6f4d9.tar.gz
ui-shared: generate proper links in cgit_object_link()
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 1e12529..a959224 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -359,29 +359,21 @@ void cgit_patch_link(char *name, char *title, char *class, char *head,
359 359
360void cgit_object_link(struct object *obj) 360void cgit_object_link(struct object *obj)
361{ 361{
362 char *page, *arg, *url; 362 char *page, *rev, *name;
363 363
364 if (obj->type == OBJ_COMMIT) { 364 if (obj->type == OBJ_COMMIT) {
365 cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL, 365 cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL,
366 ctx.qry.head, sha1_to_hex(obj->sha1)); 366 ctx.qry.head, sha1_to_hex(obj->sha1));
367 return; 367 return;
368 } else if (obj->type == OBJ_TREE) { 368 } else if (obj->type == OBJ_TREE)
369 page = "tree"; 369 page = "tree";
370 arg = "id"; 370 else if (obj->type == OBJ_TAG)
371 } else if (obj->type == OBJ_TAG) {
372 page = "tag"; 371 page = "tag";
373 arg = "id"; 372 else
374 } else {
375 page = "blob"; 373 page = "blob";
376 arg = "id"; 374 rev = sha1_to_hex(obj->sha1);
377 } 375 name = fmt("%s %s", typename(obj->type), rev);
378 376 reporevlink(page, name, NULL, NULL, ctx.qry.head, rev, NULL);
379 url = cgit_pageurl(ctx.qry.repo, page,
380 fmt("%s=%s", arg, sha1_to_hex(obj->sha1)));
381 html_link_open(url, NULL, NULL);
382 htmlf("%s %s", typename(obj->type),
383 sha1_to_hex(obj->sha1));
384 html_link_close();
385} 377}
386 378
387void cgit_print_date(time_t secs, char *format, int local_time) 379void cgit_print_date(time_t secs, char *format, int local_time)