Author: Ondrej Jirman <ondrej.jirman@zonio.net>
Implemented configurable HEAD shortlog on summary page. This mirrors similiar functionality in gitweb. After clicking on project on projectlist you will immediatelly see quick summary of last N commits on HEAD. [lh: changed from HEAD to cgit_query_head] Signed-off-by: Lars Hjemli <hjemli@gmail.com>
cgit.h | 1 + cgitrc | 5 +++++ shared.c | 3 +++ ui-summary.c | 8 +++++++-
diff --git a/cgit.h b/cgit.h index d6bcde26f08fb3743de1046a88c81b13a9c02917..2f3fca18fe0f3cb0a8742ae262c06056e3caf25f 100644 --- a/cgit.h +++ b/cgit.h @@ -127,6 +127,7 @@ extern int cgit_cache_repo_ttl; extern int cgit_cache_dynamic_ttl; extern int cgit_cache_static_ttl; extern int cgit_cache_max_create_time; +extern int cgit_summary_log; extern int cgit_max_msg_len; extern int cgit_max_repodesc_len; diff --git a/cgitrc b/cgitrc index 054a708f2330b478c520efd9421b1397dec613a6..0f602e471a73e177d2a15643fd539f5204ad773a 100644 --- a/cgitrc +++ b/cgitrc @@ -20,6 +20,11 @@ ## Enable/disable display of 'number of lines changed' in log view #enable-log-linecount=0 +## Enable/disable display of HEAD shortlog in summary view. Set it to maximum +## number of commits that should be displayed +#summary-log=0 + + ## Specify a root for virtual urls. This makes cgit generate urls like ## ## http://localhost/git/repo/log/?id=master diff --git a/shared.c b/shared.c index e3123a80d818ab308aba02009a34734d0895815b..b6d2fa1efe6a47f93054d6a6af29c3b4a5dbbb03 100644 --- a/shared.c +++ b/shared.c @@ -34,6 +34,7 @@ int cgit_cache_repo_ttl = 5; int cgit_cache_dynamic_ttl = 5; int cgit_cache_static_ttl = -1; int cgit_cache_max_create_time = 5; +int cgit_summary_log = 0; int cgit_max_msg_len = 60; int cgit_max_repodesc_len = 60; @@ -164,6 +165,8 @@ else if (!strcmp(name, "max-repodesc-length")) cgit_max_repodesc_len = atoi(value); else if (!strcmp(name, "max-commit-count")) cgit_max_commit_count = atoi(value); + else if (!strcmp(name, "summary-log")) + cgit_summary_log = atoi(value); else if (!strcmp(name, "agefile")) cgit_agefile = xstrdup(value); else if (!strcmp(name, "repo.group")) diff --git a/ui-summary.c b/ui-summary.c index 15e8aec9b6460ac98e6ea6386dfd718583863d0a..4bda4c2f73f8ed98195e5d0c427c6d85a3a9cb05 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -19,6 +19,9 @@ char buf[256], *url; strncpy(buf, refname, sizeof(buf)); commit = lookup_commit(sha1); + // object is not really parsed at this point, because of some fallout + // from previous calls to git functions in cgit_print_log() + commit->object.parsed = 0; if (commit && !parse_commit(commit)){ info = cgit_parse_commit(commit); html("<tr><td>"); @@ -203,8 +206,11 @@ html(""); if (cgit_repo->readme) html_include(cgit_repo->readme); html("</div>"); - + if (cgit_summary_log > 0) + cgit_print_log(cgit_query_head, 0, cgit_summary_log, NULL, NULL, 0); html("<table class='list nowrap'>"); + if (cgit_summary_log > 0) + html("<tr class='nohover'><td colspan='4'> </td></tr>"); cgit_print_branches(); html("<tr class='nohover'><td colspan='4'> </td></tr>"); cgit_print_tags();