X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/9c5229ea394808f90433ee84439503bee124e1de..f135569b2be3fb1816f802f9a162b3743b735d1c:/ui-summary.c diff --git a/ui-summary.c b/ui-summary.c index 638c8f6..0b66b52 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -7,61 +7,25 @@ */ #include "cgit.h" +#include "html.h" +#include "ui-log.h" +#include "ui-refs.h" -static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, - int flags, void *cb_data) +void cgit_print_summary() { - struct commit *commit; - struct commitinfo *info; - char buf[256], *url; - - commit = lookup_commit(sha1); - if (commit && !parse_commit(commit)){ - info = cgit_parse_commit(commit); - html(""); - url = cgit_pageurl(cgit_query_repo, "log", - fmt("h=%s", refname)); - html_link_open(url, NULL, NULL); - strncpy(buf, refname, sizeof(buf)); - html_txt(buf); - html_link_close(); - html(""); - cgit_print_date(commit->date); - html(""); - url = cgit_pageurl(cgit_query_repo, "commit", - fmt("id=%s", sha1_to_hex(sha1))); - html_link_open(url, NULL, NULL); - html_txt(info->subject); - html_link_close(); - html(""); - html_txt(info->author); - html("\n"); - cgit_free_commitinfo(info); - } else { - html(""); - html_txt(buf); - html(""); - htmlf("*** bad ref %s", sha1_to_hex(sha1)); - html("\n"); + if (ctx.repo->readme) { + html("
"); + html_include(ctx.repo->readme); + html("
"); } - return 0; -} - -static void cgit_print_branches() -{ - html(""); - html("" - "" - "" - "\n"); - for_each_branch_ref(cgit_print_branch_cb, NULL); + if (ctx.cfg.summary_log > 0) + cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, + NULL, NULL, 0); + html("
BranchUpdatedCommit subjectAuthor
"); + if (ctx.cfg.summary_log > 0) + html(""); + cgit_print_branches(ctx.cfg.summary_branches); + html(""); + cgit_print_tags(ctx.cfg.summary_tags); html("
 
 
"); } - -void cgit_print_summary() -{ - html("

"); - html_txt("Repo summary page"); - html("

"); - cgit_print_branches(); -}