X-Git-Url: https://git.cameronkatri.com/cgit.git/blobdiff_plain/c6bea0375aa7898ea3229483741944303740801e..9c8be943f72b6f1bda5a31ce401899c3dd734e98:/ui-shared.c?ds=sidebyside diff --git a/ui-shared.c b/ui-shared.c index 1fc5c09..9319881 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -262,6 +262,12 @@ void cgit_summary_link(char *name, char *title, char *class, char *head) reporevlink(NULL, name, title, class, head, NULL, NULL); } +void cgit_tag_link(char *name, char *title, char *class, char *head, + char *rev) +{ + reporevlink("tag", name, title, class, head, rev, NULL); +} + void cgit_tree_link(char *name, char *title, char *class, char *head, char *rev, char *path) { @@ -359,29 +365,23 @@ void cgit_patch_link(char *name, char *title, char *class, char *head, void cgit_object_link(struct object *obj) { - char *page, *arg, *url; + char *page, *shortrev, *fullrev, *name; + fullrev = sha1_to_hex(obj->sha1); + shortrev = xstrdup(fullrev); + shortrev[10] = '\0'; if (obj->type == OBJ_COMMIT) { - cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL, - ctx.qry.head, sha1_to_hex(obj->sha1)); + cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL, + ctx.qry.head, fullrev); return; - } else if (obj->type == OBJ_TREE) { + } else if (obj->type == OBJ_TREE) page = "tree"; - arg = "id"; - } else if (obj->type == OBJ_TAG) { + else if (obj->type == OBJ_TAG) page = "tag"; - arg = "id"; - } else { + else page = "blob"; - arg = "id"; - } - - url = cgit_pageurl(ctx.qry.repo, page, - fmt("%s=%s", arg, sha1_to_hex(obj->sha1))); - html_link_open(url, NULL, NULL); - htmlf("%s %s", typename(obj->type), - sha1_to_hex(obj->sha1)); - html_link_close(); + name = fmt("%s %s...", typename(obj->type), shortrev); + reporevlink(page, name, NULL, NULL, ctx.qry.head, fullrev, NULL); } void cgit_print_date(time_t secs, char *format, int local_time) @@ -496,9 +496,9 @@ void cgit_print_docend() if (ctx.cfg.footer) html_include(ctx.cfg.footer); else { - html("