X-Git-Url: https://git.cameronkatri.com/cgit.git/blobdiff_plain/148fb9622c6a96021e572d1a372e38896506031f..5764fe95469f65fdee285467f0f87d188fc1a780:/ui-summary.c diff --git a/ui-summary.c b/ui-summary.c index 8ff3642..318148a 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -7,56 +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"); - } 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("
"); + } + html(""); + cgit_print_branches(ctx.cfg.summary_branches); + html(""); + cgit_print_tags(ctx.cfg.summary_tags); + if (ctx.cfg.summary_log > 0) { + html(""); + cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, + NULL, NULL, 0); } - return 0; -} - -static void cgit_print_branches() -{ - html("
 
 
"); - html("\n"); - for_each_branch_ref(cgit_print_branch_cb, NULL); html("
BranchUpdatedCommit subjectAuthor
"); } - -void cgit_print_summary() -{ - html("

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

"); - cgit_print_branches(); -}