X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/0274b57d55a12ed38259757dbfae96b79cfa2e0b..c4b45de33458f66f5a768530d738f6c28e56cf49:/ui-log.c diff --git a/ui-log.c b/ui-log.c index 631e46d..2f90778 100644 --- a/ui-log.c +++ b/ui-log.c @@ -35,21 +35,20 @@ void print_commit(struct commit *commit) { struct commitinfo *info; char *tmp; + int cols = 2; info = cgit_parse_commit(commit); - html(""); + htmlf("", + ctx.qry.showmsg ? " class='logheader'" : ""); tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); html_link_open(tmp, NULL, NULL); cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); html_link_close(); - html(""); - if (ctx.qry.showmsg) - html(""); + htmlf("", + ctx.qry.showmsg ? " class='logsubject'" : ""); cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, sha1_to_hex(commit->object.sha1)); - if (ctx.qry.showmsg) - html(""); html(""); html_txt(info->author); if (ctx.repo->enable_log_filecount) { @@ -66,31 +65,44 @@ void print_commit(struct commit *commit) } html("\n"); if (ctx.qry.showmsg) { - html("
"); - html_txt(info->msg); - html("

"); if (ctx.repo->enable_log_filecount) { - html(""); + cols++; if (ctx.repo->enable_log_linecount) - html(""); + cols++; } - html("\n"); + htmlf("", + cols); + html_txt(info->msg); + html("\n"); } cgit_free_commitinfo(info); } +static const char *disambiguate_ref(const char *ref) +{ + unsigned char sha1[20]; + const char *longref; + + longref = fmt("refs/heads/%s", ref); + if (get_sha1(longref, sha1) == 0) + return longref; + + return ref; +} void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, char *path, int pager) { struct rev_info rev; struct commit *commit; - const char *argv[] = {NULL, tip, NULL, NULL, NULL}; + const char *argv[] = {NULL, NULL, NULL, NULL, NULL}; int argc = 2; int i, columns = 3; if (!tip) - argv[1] = ctx.qry.head; + tip = ctx.qry.head; + + argv[1] = disambiguate_ref(tip); if (grep && pattern && (!strcmp(grep, "grep") || !strcmp(grep, "author") ||