summaryrefslogtreecommitdiffabout
authorOndrej Jirman <ondrej.jirman@zonio.net>2007-05-26 01:33:41 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-05-31 08:25:48 (UTC)
commit51a960a3ca6b0cade97db287a342996c3e1de48d (patch) (side-by-side diff)
treed3360cd301c9e13d7aa9492e6628bf8d71736608
parent6130231ed5e7475836a44d79d5f09e300e71a407 (diff)
downloadcgit-51a960a3ca6b0cade97db287a342996c3e1de48d.zip
cgit-51a960a3ca6b0cade97db287a342996c3e1de48d.tar.gz
cgit-51a960a3ca6b0cade97db287a342996c3e1de48d.tar.bz2
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>
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
@@ -129,2 +129,3 @@ extern int cgit_cache_static_ttl;
extern int cgit_cache_max_create_time;
+extern int cgit_summary_log;
diff --git a/cgitrc b/cgitrc
index 054a708..0f602e4 100644
--- a/cgitrc
+++ b/cgitrc
@@ -22,2 +22,7 @@
+## 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
diff --git a/shared.c b/shared.c
index e3123a8..b6d2fa1 100644
--- a/shared.c
+++ b/shared.c
@@ -36,2 +36,3 @@ int cgit_cache_static_ttl = -1;
int cgit_cache_max_create_time = 5;
+int cgit_summary_log = 0;
@@ -166,2 +167,4 @@ void cgit_global_config_cb(const char *name, const char *value)
cgit_max_commit_count = atoi(value);
+ else if (!strcmp(name, "summary-log"))
+ cgit_summary_log = atoi(value);
else if (!strcmp(name, "agefile"))
diff --git a/ui-summary.c b/ui-summary.c
index 15e8aec..4bda4c2 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -21,2 +21,5 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *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)){
@@ -205,4 +208,7 @@ void cgit_print_summary()
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();