author | Lars Hjemli <hjemli@gmail.com> | 2007-01-28 11:17:03 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-01-28 11:17:03 (UTC) |
commit | 7dd50c98d73bf6c579b8ce5893739a2d0ffc00d5 (patch) (unidiff) | |
tree | 17f0e21c129723468a1f291faba52580993a39b1 | |
parent | d8b0cca2606f8919208ea68549ff60c6e5fe91bb (diff) | |
download | cgit-7dd50c98d73bf6c579b8ce5893739a2d0ffc00d5.zip cgit-7dd50c98d73bf6c579b8ce5893739a2d0ffc00d5.tar.gz cgit-7dd50c98d73bf6c579b8ce5893739a2d0ffc00d5.tar.bz2 |
Add parameter to adjust max message length in log listings
The parameter "max-message-length" can be specified in cgitrc, default value
is 60.
This affects the log message shown in repo summary and shortlog.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.h | 2 | ||||
-rw-r--r-- | shared.c | 4 | ||||
-rw-r--r-- | ui-log.c | 2 | ||||
-rw-r--r-- | ui-summary.c | 2 |
4 files changed, 8 insertions, 2 deletions
@@ -43,24 +43,26 @@ extern char *cgit_logo; | |||
43 | extern char *cgit_logo_link; | 43 | extern char *cgit_logo_link; |
44 | extern char *cgit_virtual_root; | 44 | extern char *cgit_virtual_root; |
45 | extern char *cgit_cache_root; | 45 | extern char *cgit_cache_root; |
46 | 46 | ||
47 | extern int cgit_nocache; | 47 | extern int cgit_nocache; |
48 | extern int cgit_max_lock_attempts; | 48 | extern int cgit_max_lock_attempts; |
49 | extern int cgit_cache_root_ttl; | 49 | extern int cgit_cache_root_ttl; |
50 | extern int cgit_cache_repo_ttl; | 50 | extern int cgit_cache_repo_ttl; |
51 | extern int cgit_cache_dynamic_ttl; | 51 | extern int cgit_cache_dynamic_ttl; |
52 | extern int cgit_cache_static_ttl; | 52 | extern int cgit_cache_static_ttl; |
53 | extern int cgit_cache_max_create_time; | 53 | extern int cgit_cache_max_create_time; |
54 | 54 | ||
55 | extern int cgit_max_msg_len; | ||
56 | |||
55 | extern char *cgit_repo_name; | 57 | extern char *cgit_repo_name; |
56 | extern char *cgit_repo_desc; | 58 | extern char *cgit_repo_desc; |
57 | extern char *cgit_repo_owner; | 59 | extern char *cgit_repo_owner; |
58 | 60 | ||
59 | extern int cgit_query_has_symref; | 61 | extern int cgit_query_has_symref; |
60 | extern int cgit_query_has_sha1; | 62 | extern int cgit_query_has_sha1; |
61 | 63 | ||
62 | extern char *cgit_querystring; | 64 | extern char *cgit_querystring; |
63 | extern char *cgit_query_repo; | 65 | extern char *cgit_query_repo; |
64 | extern char *cgit_query_page; | 66 | extern char *cgit_query_page; |
65 | extern char *cgit_query_search; | 67 | extern char *cgit_query_search; |
66 | extern char *cgit_query_head; | 68 | extern char *cgit_query_head; |
@@ -16,24 +16,26 @@ char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/"; | |||
16 | char *cgit_virtual_root = NULL; | 16 | char *cgit_virtual_root = NULL; |
17 | 17 | ||
18 | char *cgit_cache_root = "/var/cache/cgit"; | 18 | char *cgit_cache_root = "/var/cache/cgit"; |
19 | 19 | ||
20 | int cgit_nocache = 0; | 20 | int cgit_nocache = 0; |
21 | int cgit_max_lock_attempts = 5; | 21 | int cgit_max_lock_attempts = 5; |
22 | int cgit_cache_root_ttl = 5; | 22 | int cgit_cache_root_ttl = 5; |
23 | int cgit_cache_repo_ttl = 5; | 23 | int cgit_cache_repo_ttl = 5; |
24 | int cgit_cache_dynamic_ttl = 5; | 24 | int cgit_cache_dynamic_ttl = 5; |
25 | int cgit_cache_static_ttl = -1; | 25 | int cgit_cache_static_ttl = -1; |
26 | int cgit_cache_max_create_time = 5; | 26 | int cgit_cache_max_create_time = 5; |
27 | 27 | ||
28 | int cgit_max_msg_len = 60; | ||
29 | |||
28 | char *cgit_repo_name = NULL; | 30 | char *cgit_repo_name = NULL; |
29 | char *cgit_repo_desc = NULL; | 31 | char *cgit_repo_desc = NULL; |
30 | char *cgit_repo_owner = NULL; | 32 | char *cgit_repo_owner = NULL; |
31 | 33 | ||
32 | int cgit_query_has_symref = 0; | 34 | int cgit_query_has_symref = 0; |
33 | int cgit_query_has_sha1 = 0; | 35 | int cgit_query_has_sha1 = 0; |
34 | 36 | ||
35 | char *cgit_querystring = NULL; | 37 | char *cgit_querystring = NULL; |
36 | char *cgit_query_repo = NULL; | 38 | char *cgit_query_repo = NULL; |
37 | char *cgit_query_page = NULL; | 39 | char *cgit_query_page = NULL; |
38 | char *cgit_query_head = NULL; | 40 | char *cgit_query_head = NULL; |
39 | char *cgit_query_search = NULL; | 41 | char *cgit_query_search = NULL; |
@@ -61,24 +63,26 @@ void cgit_global_config_cb(const char *name, const char *value) | |||
61 | else if (!strcmp(name, "nocache")) | 63 | else if (!strcmp(name, "nocache")) |
62 | cgit_nocache = atoi(value); | 64 | cgit_nocache = atoi(value); |
63 | else if (!strcmp(name, "cache-root")) | 65 | else if (!strcmp(name, "cache-root")) |
64 | cgit_cache_root = xstrdup(value); | 66 | cgit_cache_root = xstrdup(value); |
65 | else if (!strcmp(name, "cache-root-ttl")) | 67 | else if (!strcmp(name, "cache-root-ttl")) |
66 | cgit_cache_root_ttl = atoi(value); | 68 | cgit_cache_root_ttl = atoi(value); |
67 | else if (!strcmp(name, "cache-repo-ttl")) | 69 | else if (!strcmp(name, "cache-repo-ttl")) |
68 | cgit_cache_repo_ttl = atoi(value); | 70 | cgit_cache_repo_ttl = atoi(value); |
69 | else if (!strcmp(name, "cache-static-ttl")) | 71 | else if (!strcmp(name, "cache-static-ttl")) |
70 | cgit_cache_static_ttl = atoi(value); | 72 | cgit_cache_static_ttl = atoi(value); |
71 | else if (!strcmp(name, "cache-dynamic-ttl")) | 73 | else if (!strcmp(name, "cache-dynamic-ttl")) |
72 | cgit_cache_dynamic_ttl = atoi(value); | 74 | cgit_cache_dynamic_ttl = atoi(value); |
75 | else if (!strcmp(name, "max-message-length")) | ||
76 | cgit_max_msg_len = atoi(value); | ||
73 | } | 77 | } |
74 | 78 | ||
75 | void cgit_repo_config_cb(const char *name, const char *value) | 79 | void cgit_repo_config_cb(const char *name, const char *value) |
76 | { | 80 | { |
77 | if (!strcmp(name, "name")) | 81 | if (!strcmp(name, "name")) |
78 | cgit_repo_name = xstrdup(value); | 82 | cgit_repo_name = xstrdup(value); |
79 | else if (!strcmp(name, "desc")) | 83 | else if (!strcmp(name, "desc")) |
80 | cgit_repo_desc = xstrdup(value); | 84 | cgit_repo_desc = xstrdup(value); |
81 | else if (!strcmp(name, "owner")) | 85 | else if (!strcmp(name, "owner")) |
82 | cgit_repo_owner = xstrdup(value); | 86 | cgit_repo_owner = xstrdup(value); |
83 | } | 87 | } |
84 | 88 | ||
@@ -14,25 +14,25 @@ void print_commit(struct commit *commit) | |||
14 | struct commitinfo *info; | 14 | struct commitinfo *info; |
15 | struct tm *time; | 15 | struct tm *time; |
16 | 16 | ||
17 | info = cgit_parse_commit(commit); | 17 | info = cgit_parse_commit(commit); |
18 | time = gmtime(&commit->date); | 18 | time = gmtime(&commit->date); |
19 | html("<tr><td>"); | 19 | html("<tr><td>"); |
20 | strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", time); | 20 | strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", time); |
21 | html_txt(buf); | 21 | html_txt(buf); |
22 | html("</td><td>"); | 22 | html("</td><td>"); |
23 | char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1)); | 23 | char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1)); |
24 | char *url = cgit_pageurl(cgit_query_repo, "commit", qry); | 24 | char *url = cgit_pageurl(cgit_query_repo, "commit", qry); |
25 | html_link_open(url, NULL, NULL); | 25 | html_link_open(url, NULL, NULL); |
26 | html_ntxt(80, info->subject); | 26 | html_ntxt(cgit_max_msg_len, info->subject); |
27 | html_link_close(); | 27 | html_link_close(); |
28 | html("</td><td>"); | 28 | html("</td><td>"); |
29 | html_txt(info->author); | 29 | html_txt(info->author); |
30 | html("</td></tr>\n"); | 30 | html("</td></tr>\n"); |
31 | cgit_free_commitinfo(info); | 31 | cgit_free_commitinfo(info); |
32 | } | 32 | } |
33 | 33 | ||
34 | 34 | ||
35 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep) | 35 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep) |
36 | { | 36 | { |
37 | struct rev_info rev; | 37 | struct rev_info rev; |
38 | struct commit *commit; | 38 | struct commit *commit; |
diff --git a/ui-summary.c b/ui-summary.c index 04d4912..5518d01 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -24,25 +24,25 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, | |||
24 | fmt("h=%s", refname)); | 24 | fmt("h=%s", refname)); |
25 | html_link_open(url, NULL, NULL); | 25 | html_link_open(url, NULL, NULL); |
26 | html_txt(buf); | 26 | html_txt(buf); |
27 | html_link_close(); | 27 | html_link_close(); |
28 | html("</td><td>"); | 28 | html("</td><td>"); |
29 | cgit_print_date(commit->date); | 29 | cgit_print_date(commit->date); |
30 | html("</td><td>"); | 30 | html("</td><td>"); |
31 | html_txt(info->author); | 31 | html_txt(info->author); |
32 | html("</td><td>"); | 32 | html("</td><td>"); |
33 | url = cgit_pageurl(cgit_query_repo, "commit", | 33 | url = cgit_pageurl(cgit_query_repo, "commit", |
34 | fmt("id=%s", sha1_to_hex(sha1))); | 34 | fmt("id=%s", sha1_to_hex(sha1))); |
35 | html_link_open(url, NULL, NULL); | 35 | html_link_open(url, NULL, NULL); |
36 | html_ntxt(80, info->subject); | 36 | html_ntxt(cgit_max_msg_len, info->subject); |
37 | html_link_close(); | 37 | html_link_close(); |
38 | html("</td></tr>\n"); | 38 | html("</td></tr>\n"); |
39 | cgit_free_commitinfo(info); | 39 | cgit_free_commitinfo(info); |
40 | } else { | 40 | } else { |
41 | html("<tr><td>"); | 41 | html("<tr><td>"); |
42 | html_txt(buf); | 42 | html_txt(buf); |
43 | html("</td><td colspan='3'>"); | 43 | html("</td><td colspan='3'>"); |
44 | htmlf("*** bad ref %s ***", sha1_to_hex(sha1)); | 44 | htmlf("*** bad ref %s ***", sha1_to_hex(sha1)); |
45 | html("</td></tr>\n"); | 45 | html("</td></tr>\n"); |
46 | } | 46 | } |
47 | return 0; | 47 | return 0; |
48 | } | 48 | } |