diff options
author | Ondrej Jirman | 2007-05-26 03:33:41 +0200 |
---|---|---|
committer | Lars Hjemli | 2007-05-31 10:25:48 +0200 |
commit | 51a960a3ca6b0cade97db287a342996c3e1de48d (patch) | |
tree | d3360cd301c9e13d7aa9492e6628bf8d71736608 | |
parent | Check for NULL commit buffer in cgit_parse_commit() (diff) | |
download | cgit-51a960a3ca6b0cade97db287a342996c3e1de48d.tar.gz cgit-51a960a3ca6b0cade97db287a342996c3e1de48d.zip |
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>
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc | 5 | ||||
-rw-r--r-- | shared.c | 3 | ||||
-rw-r--r-- | ui-summary.c | 8 |
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 | |||
@@ -127,6 +127,7 @@ extern int cgit_cache_repo_ttl; | |||
127 | extern int cgit_cache_dynamic_ttl; | 127 | extern int cgit_cache_dynamic_ttl; |
128 | extern int cgit_cache_static_ttl; | 128 | extern int cgit_cache_static_ttl; |
129 | extern int cgit_cache_max_create_time; | 129 | extern int cgit_cache_max_create_time; |
130 | extern int cgit_summary_log; | ||
130 | 131 | ||
131 | extern int cgit_max_msg_len; | 132 | extern int cgit_max_msg_len; |
132 | extern int cgit_max_repodesc_len; | 133 | extern int cgit_max_repodesc_len; |
diff --git a/cgitrc b/cgitrc index 054a708..0f602e4 100644 --- a/cgitrc +++ b/cgitrc | |||
@@ -20,6 +20,11 @@ | |||
20 | #enable-log-linecount=0 | 20 | #enable-log-linecount=0 |
21 | 21 | ||
22 | 22 | ||
23 | ## Enable/disable display of HEAD shortlog in summary view. Set it to maximum | ||
24 | ## number of commits that should be displayed | ||
25 | #summary-log=0 | ||
26 | |||
27 | |||
23 | ## Specify a root for virtual urls. This makes cgit generate urls like | 28 | ## Specify a root for virtual urls. This makes cgit generate urls like |
24 | ## | 29 | ## |
25 | ## http://localhost/git/repo/log/?id=master | 30 | ## http://localhost/git/repo/log/?id=master |
diff --git a/shared.c b/shared.c index e3123a8..b6d2fa1 100644 --- a/shared.c +++ b/shared.c | |||
@@ -34,6 +34,7 @@ int cgit_cache_repo_ttl = 5; | |||
34 | int cgit_cache_dynamic_ttl = 5; | 34 | int cgit_cache_dynamic_ttl = 5; |
35 | int cgit_cache_static_ttl = -1; | 35 | int cgit_cache_static_ttl = -1; |
36 | int cgit_cache_max_create_time = 5; | 36 | int cgit_cache_max_create_time = 5; |
37 | int cgit_summary_log = 0; | ||
37 | 38 | ||
38 | int cgit_max_msg_len = 60; | 39 | int cgit_max_msg_len = 60; |
39 | int cgit_max_repodesc_len = 60; | 40 | int cgit_max_repodesc_len = 60; |
@@ -164,6 +165,8 @@ void cgit_global_config_cb(const char *name, const char *value) | |||
164 | cgit_max_repodesc_len = atoi(value); | 165 | cgit_max_repodesc_len = atoi(value); |
165 | else if (!strcmp(name, "max-commit-count")) | 166 | else if (!strcmp(name, "max-commit-count")) |
166 | cgit_max_commit_count = atoi(value); | 167 | cgit_max_commit_count = atoi(value); |
168 | else if (!strcmp(name, "summary-log")) | ||
169 | cgit_summary_log = atoi(value); | ||
167 | else if (!strcmp(name, "agefile")) | 170 | else if (!strcmp(name, "agefile")) |
168 | cgit_agefile = xstrdup(value); | 171 | cgit_agefile = xstrdup(value); |
169 | else if (!strcmp(name, "repo.group")) | 172 | else if (!strcmp(name, "repo.group")) |
diff --git a/ui-summary.c b/ui-summary.c index 15e8aec..4bda4c2 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -19,6 +19,9 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, | |||
19 | 19 | ||
20 | strncpy(buf, refname, sizeof(buf)); | 20 | strncpy(buf, refname, sizeof(buf)); |
21 | commit = lookup_commit(sha1); | 21 | commit = lookup_commit(sha1); |
22 | // object is not really parsed at this point, because of some fallout | ||
23 | // from previous calls to git functions in cgit_print_log() | ||
24 | commit->object.parsed = 0; | ||
22 | if (commit && !parse_commit(commit)){ | 25 | if (commit && !parse_commit(commit)){ |
23 | info = cgit_parse_commit(commit); | 26 | info = cgit_parse_commit(commit); |
24 | html("<tr><td>"); | 27 | html("<tr><td>"); |
@@ -203,8 +206,11 @@ void cgit_print_summary() | |||
203 | if (cgit_repo->readme) | 206 | if (cgit_repo->readme) |
204 | html_include(cgit_repo->readme); | 207 | html_include(cgit_repo->readme); |
205 | html("</div>"); | 208 | html("</div>"); |
206 | 209 | if (cgit_summary_log > 0) | |
210 | cgit_print_log(cgit_query_head, 0, cgit_summary_log, NULL, NULL, 0); | ||
207 | html("<table class='list nowrap'>"); | 211 | html("<table class='list nowrap'>"); |
212 | if (cgit_summary_log > 0) | ||
213 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); | ||
208 | cgit_print_branches(); | 214 | cgit_print_branches(); |
209 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); | 215 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); |
210 | cgit_print_tags(); | 216 | cgit_print_tags(); |