summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
authorLars Hjemli <hjemli@gmail.com>2008-12-06 10:34:48 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-12-06 10:34:48 (UTC)
commite550440233875b298f8574e9273457516791010f (patch) (unidiff)
tree37464c686f1f2d8c5ba513c7dca5daa886dc81a6 /ui-shared.c
parent3157ea3b7e5204dba2892ffb54d641746c4c7ca4 (diff)
parentc57aceb1d2f1a7d9fd3218fc8c6e9ea01b2952d2 (diff)
downloadcgit-e550440233875b298f8574e9273457516791010f.zip
cgit-e550440233875b298f8574e9273457516791010f.tar.gz
cgit-e550440233875b298f8574e9273457516791010f.tar.bz2
Merge branch 'snapshot-fixes'
Diffstat (limited to 'ui-shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 224e5f3..9319881 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -362,27 +362,29 @@ void cgit_patch_link(char *name, char *title, char *class, char *head,
362{ 362{
363 reporevlink("patch", name, title, class, head, rev, NULL); 363 reporevlink("patch", name, title, class, head, rev, NULL);
364} 364}
365 365
366void cgit_object_link(struct object *obj) 366void cgit_object_link(struct object *obj)
367{ 367{
368 char *page, *rev, *name; 368 char *page, *shortrev, *fullrev, *name;
369 369
370 fullrev = sha1_to_hex(obj->sha1);
371 shortrev = xstrdup(fullrev);
372 shortrev[10] = '\0';
370 if (obj->type == OBJ_COMMIT) { 373 if (obj->type == OBJ_COMMIT) {
371 cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL, 374 cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL,
372 ctx.qry.head, sha1_to_hex(obj->sha1)); 375 ctx.qry.head, fullrev);
373 return; 376 return;
374 } else if (obj->type == OBJ_TREE) 377 } else if (obj->type == OBJ_TREE)
375 page = "tree"; 378 page = "tree";
376 else if (obj->type == OBJ_TAG) 379 else if (obj->type == OBJ_TAG)
377 page = "tag"; 380 page = "tag";
378 else 381 else
379 page = "blob"; 382 page = "blob";
380 rev = sha1_to_hex(obj->sha1); 383 name = fmt("%s %s...", typename(obj->type), shortrev);
381 name = fmt("%s %s", typename(obj->type), rev); 384 reporevlink(page, name, NULL, NULL, ctx.qry.head, fullrev, NULL);
382 reporevlink(page, name, NULL, NULL, ctx.qry.head, rev, NULL);
383} 385}
384 386
385void cgit_print_date(time_t secs, char *format, int local_time) 387void cgit_print_date(time_t secs, char *format, int local_time)
386{ 388{
387 char buf[64]; 389 char buf[64];
388 struct tm *time; 390 struct tm *time;
@@ -704,11 +706,10 @@ void cgit_print_snapshot_links(const char *repo, const char *head,
704 706
705 for (f = cgit_snapshot_formats; f->suffix; f++) { 707 for (f = cgit_snapshot_formats; f->suffix; f++) {
706 if (!(snapshots & f->bit)) 708 if (!(snapshots & f->bit))
707 continue; 709 continue;
708 filename = fmt("%s-%s%s", cgit_repobasename(repo), hex, 710 filename = fmt("%s-%s%s", cgit_repobasename(repo), hex,
709 f->suffix); 711 f->suffix);
710 cgit_snapshot_link(filename, NULL, NULL, (char *)head, 712 cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename);
711 (char *)hex, filename);
712 html("<br/>"); 713 html("<br/>");
713 } 714 }
714} 715}