summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.h1
-rw-r--r--cgitrc5
-rw-r--r--shared.c3
-rw-r--r--ui-summary.c8
4 files changed, 16 insertions, 1 deletions
diff --git a/cgit.h b/cgit.h
index d6bcde2..2f3fca1 100644
--- a/cgit.h
+++ b/cgit.h
@@ -118,24 +118,25 @@ extern char *cgit_cache_root;
extern char *cgit_repo_group;
extern int cgit_nocache;
extern int cgit_snapshots;
extern int cgit_enable_log_filecount;
extern int cgit_enable_log_linecount;
extern int cgit_max_lock_attempts;
extern int cgit_cache_root_ttl;
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;
extern int cgit_max_commit_count;
extern int cgit_query_has_symref;
extern int cgit_query_has_sha1;
extern char *cgit_querystring;
extern char *cgit_query_repo;
extern char *cgit_query_page;
extern char *cgit_query_search;
diff --git a/cgitrc b/cgitrc
index 054a708..0f602e4 100644
--- a/cgitrc
+++ b/cgitrc
@@ -11,24 +11,29 @@
## Enable/disable snapshots by default. This can be overridden per repo
#snapshots=0
## Enable/disable display of 'number of files changed' in log view
#enable-log-filecount=0
## 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
##
## instead of
##
## http://localhost/cgit/cgit.cgi?r=repo&p=log&id=master
##
## For this to work with apache, rewrite rules must be added to httpd.conf,
## possibly looking something like this:
##
## RewriteRule ^/git/$ /cgit/cgit.cgi [L,QSA]
diff --git a/shared.c b/shared.c
index e3123a8..b6d2fa1 100644
--- a/shared.c
+++ b/shared.c
@@ -25,24 +25,25 @@ char *cgit_cache_root = "/var/cache/cgit";
char *cgit_repo_group = NULL;
int cgit_nocache = 0;
int cgit_snapshots = 0;
int cgit_enable_log_filecount = 0;
int cgit_enable_log_linecount = 0;
int cgit_max_lock_attempts = 5;
int cgit_cache_root_ttl = 5;
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;
int cgit_max_commit_count = 50;
int cgit_query_has_symref = 0;
int cgit_query_has_sha1 = 0;
char *cgit_querystring = NULL;
char *cgit_query_repo = NULL;
char *cgit_query_page = NULL;
char *cgit_query_head = NULL;
@@ -155,24 +156,26 @@ void cgit_global_config_cb(const char *name, const char *value)
else if (!strcmp(name, "cache-repo-ttl"))
cgit_cache_repo_ttl = atoi(value);
else if (!strcmp(name, "cache-static-ttl"))
cgit_cache_static_ttl = atoi(value);
else if (!strcmp(name, "cache-dynamic-ttl"))
cgit_cache_dynamic_ttl = atoi(value);
else if (!strcmp(name, "max-message-length"))
cgit_max_msg_len = atoi(value);
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"))
cgit_repo_group = xstrdup(value);
else if (!strcmp(name, "repo.url"))
cgit_repo = add_repo(value);
else if (!strcmp(name, "repo.name"))
cgit_repo->name = xstrdup(value);
else if (cgit_repo && !strcmp(name, "repo.path"))
cgit_repo->path = xstrdup(value);
else if (cgit_repo && !strcmp(name, "repo.desc"))
cgit_repo->desc = xstrdup(value);
diff --git a/ui-summary.c b/ui-summary.c
index 15e8aec..4bda4c2 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -10,24 +10,27 @@
static int header;
static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
int flags, void *cb_data)
{
struct commit *commit;
struct commitinfo *info;
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>");
url = cgit_pageurl(cgit_query_repo, "log",
fmt("h=%s", refname));
html_link_open(url, NULL, NULL);
html_txt(buf);
html_link_close();
html("</td><td>");
cgit_print_age(commit->date, -1, NULL);
html("</td><td>");
html_txt(info->author);
@@ -194,19 +197,22 @@ static void cgit_print_archives()
void cgit_print_summary()
{
html("<div id='summary'>");
cgit_print_archives();
html("<h2>");
html_txt(cgit_repo->name);
html(" - ");
html_txt(cgit_repo->desc);
html("</h2>");
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'>&nbsp;</td></tr>");
cgit_print_branches();
html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
cgit_print_tags();
html("</table>");
}