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) (unidiff)
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
@@ -124,12 +124,13 @@ extern int cgit_enable_log_linecount;
124extern int cgit_max_lock_attempts; 124extern int cgit_max_lock_attempts;
125extern int cgit_cache_root_ttl; 125extern int cgit_cache_root_ttl;
126extern int cgit_cache_repo_ttl; 126extern int cgit_cache_repo_ttl;
127extern int cgit_cache_dynamic_ttl; 127extern int cgit_cache_dynamic_ttl;
128extern int cgit_cache_static_ttl; 128extern int cgit_cache_static_ttl;
129extern int cgit_cache_max_create_time; 129extern int cgit_cache_max_create_time;
130extern int cgit_summary_log;
130 131
131extern int cgit_max_msg_len; 132extern int cgit_max_msg_len;
132extern int cgit_max_repodesc_len; 133extern int cgit_max_repodesc_len;
133extern int cgit_max_commit_count; 134extern int cgit_max_commit_count;
134 135
135extern int cgit_query_has_symref; 136extern int cgit_query_has_symref;
diff --git a/cgitrc b/cgitrc
index 054a708..0f602e4 100644
--- a/cgitrc
+++ b/cgitrc
@@ -17,12 +17,17 @@
17 17
18 18
19## Enable/disable display of 'number of lines changed' in log view 19## Enable/disable display of 'number of lines changed' in log view
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
26## 31##
27## instead of 32## instead of
28## 33##
diff --git a/shared.c b/shared.c
index e3123a8..b6d2fa1 100644
--- a/shared.c
+++ b/shared.c
@@ -31,12 +31,13 @@ int cgit_enable_log_linecount = 0;
31int cgit_max_lock_attempts = 5; 31int cgit_max_lock_attempts = 5;
32int cgit_cache_root_ttl = 5; 32int cgit_cache_root_ttl = 5;
33int cgit_cache_repo_ttl = 5; 33int cgit_cache_repo_ttl = 5;
34int cgit_cache_dynamic_ttl = 5; 34int cgit_cache_dynamic_ttl = 5;
35int cgit_cache_static_ttl = -1; 35int cgit_cache_static_ttl = -1;
36int cgit_cache_max_create_time = 5; 36int cgit_cache_max_create_time = 5;
37int cgit_summary_log = 0;
37 38
38int cgit_max_msg_len = 60; 39int cgit_max_msg_len = 60;
39int cgit_max_repodesc_len = 60; 40int cgit_max_repodesc_len = 60;
40int cgit_max_commit_count = 50; 41int cgit_max_commit_count = 50;
41 42
42int cgit_query_has_symref = 0; 43int cgit_query_has_symref = 0;
@@ -161,12 +162,14 @@ void cgit_global_config_cb(const char *name, const char *value)
161 else if (!strcmp(name, "max-message-length")) 162 else if (!strcmp(name, "max-message-length"))
162 cgit_max_msg_len = atoi(value); 163 cgit_max_msg_len = atoi(value);
163 else if (!strcmp(name, "max-repodesc-length")) 164 else if (!strcmp(name, "max-repodesc-length"))
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"))
170 cgit_repo_group = xstrdup(value); 173 cgit_repo_group = xstrdup(value);
171 else if (!strcmp(name, "repo.url")) 174 else if (!strcmp(name, "repo.url"))
172 cgit_repo = add_repo(value); 175 cgit_repo = add_repo(value);
diff --git a/ui-summary.c b/ui-summary.c
index 15e8aec..4bda4c2 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -16,12 +16,15 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
16 struct commit *commit; 16 struct commit *commit;
17 struct commitinfo *info; 17 struct commitinfo *info;
18 char buf[256], *url; 18 char buf[256], *url;
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>");
25 url = cgit_pageurl(cgit_query_repo, "log", 28 url = cgit_pageurl(cgit_query_repo, "log",
26 fmt("h=%s", refname)); 29 fmt("h=%s", refname));
27 html_link_open(url, NULL, NULL); 30 html_link_open(url, NULL, NULL);
@@ -200,13 +203,16 @@ void cgit_print_summary()
200 html(" - "); 203 html(" - ");
201 html_txt(cgit_repo->desc); 204 html_txt(cgit_repo->desc);
202 html("</h2>"); 205 html("</h2>");
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'>&nbsp;</td></tr>");
208 cgit_print_branches(); 214 cgit_print_branches();
209 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); 215 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
210 cgit_print_tags(); 216 cgit_print_tags();
211 html("</table>"); 217 html("</table>");
212} 218}