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>
This commit is contained in:
Ondrej Jirman 2007-05-26 03:33:41 +02:00 committed by Lars Hjemli
parent 6130231ed5
commit 51a960a3ca
4 changed files with 16 additions and 1 deletions

1
cgit.h
View File

@ -127,6 +127,7 @@ extern int cgit_cache_repo_ttl;
extern int cgit_cache_dynamic_ttl; extern int cgit_cache_dynamic_ttl;
extern int cgit_cache_static_ttl; extern int cgit_cache_static_ttl;
extern int cgit_cache_max_create_time; extern int cgit_cache_max_create_time;
extern int cgit_summary_log;
extern int cgit_max_msg_len; extern int cgit_max_msg_len;
extern int cgit_max_repodesc_len; extern int cgit_max_repodesc_len;

5
cgitrc
View File

@ -20,6 +20,11 @@
#enable-log-linecount=0 #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 ## Specify a root for virtual urls. This makes cgit generate urls like
## ##
## http://localhost/git/repo/log/?id=master ## http://localhost/git/repo/log/?id=master

View File

@ -34,6 +34,7 @@ int cgit_cache_repo_ttl = 5;
int cgit_cache_dynamic_ttl = 5; int cgit_cache_dynamic_ttl = 5;
int cgit_cache_static_ttl = -1; int cgit_cache_static_ttl = -1;
int cgit_cache_max_create_time = 5; int cgit_cache_max_create_time = 5;
int cgit_summary_log = 0;
int cgit_max_msg_len = 60; int cgit_max_msg_len = 60;
int cgit_max_repodesc_len = 60; int cgit_max_repodesc_len = 60;
@ -164,6 +165,8 @@ void cgit_global_config_cb(const char *name, const char *value)
cgit_max_repodesc_len = atoi(value); cgit_max_repodesc_len = atoi(value);
else if (!strcmp(name, "max-commit-count")) else if (!strcmp(name, "max-commit-count"))
cgit_max_commit_count = atoi(value); cgit_max_commit_count = atoi(value);
else if (!strcmp(name, "summary-log"))
cgit_summary_log = atoi(value);
else if (!strcmp(name, "agefile")) else if (!strcmp(name, "agefile"))
cgit_agefile = xstrdup(value); cgit_agefile = xstrdup(value);
else if (!strcmp(name, "repo.group")) else if (!strcmp(name, "repo.group"))

View File

@ -19,6 +19,9 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
strncpy(buf, refname, sizeof(buf)); strncpy(buf, refname, sizeof(buf));
commit = lookup_commit(sha1); 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)){ if (commit && !parse_commit(commit)){
info = cgit_parse_commit(commit); info = cgit_parse_commit(commit);
html("<tr><td>"); html("<tr><td>");
@ -203,8 +206,11 @@ void cgit_print_summary()
if (cgit_repo->readme) if (cgit_repo->readme)
html_include(cgit_repo->readme); html_include(cgit_repo->readme);
html("</div>"); 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'>"); html("<table class='list nowrap'>");
if (cgit_summary_log > 0)
html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
cgit_print_branches(); cgit_print_branches();
html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
cgit_print_tags(); cgit_print_tags();