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 /shared.c | |
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-- | shared.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1,120 +1,124 @@ | |||
1 | /* shared.c: global vars + some callback functions | 1 | /* shared.c: global vars + some callback functions |
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
4 | * | 4 | * |
5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | 10 | ||
11 | char *cgit_root = "/usr/src/git"; | 11 | char *cgit_root = "/usr/src/git"; |
12 | char *cgit_root_title = "Git repository browser"; | 12 | char *cgit_root_title = "Git repository browser"; |
13 | char *cgit_css = "/cgit.css"; | 13 | char *cgit_css = "/cgit.css"; |
14 | char *cgit_logo = "/git-logo.png"; | 14 | char *cgit_logo = "/git-logo.png"; |
15 | char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/"; | 15 | 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; |
40 | char *cgit_query_sha1 = NULL; | 42 | char *cgit_query_sha1 = NULL; |
41 | char *cgit_query_sha2 = NULL; | 43 | char *cgit_query_sha2 = NULL; |
42 | char *cgit_query_path = NULL; | 44 | char *cgit_query_path = NULL; |
43 | int cgit_query_ofs = 0; | 45 | int cgit_query_ofs = 0; |
44 | 46 | ||
45 | int htmlfd = 0; | 47 | int htmlfd = 0; |
46 | 48 | ||
47 | void cgit_global_config_cb(const char *name, const char *value) | 49 | void cgit_global_config_cb(const char *name, const char *value) |
48 | { | 50 | { |
49 | if (!strcmp(name, "root")) | 51 | if (!strcmp(name, "root")) |
50 | cgit_root = xstrdup(value); | 52 | cgit_root = xstrdup(value); |
51 | else if (!strcmp(name, "root-title")) | 53 | else if (!strcmp(name, "root-title")) |
52 | cgit_root_title = xstrdup(value); | 54 | cgit_root_title = xstrdup(value); |
53 | else if (!strcmp(name, "css")) | 55 | else if (!strcmp(name, "css")) |
54 | cgit_css = xstrdup(value); | 56 | cgit_css = xstrdup(value); |
55 | else if (!strcmp(name, "logo")) | 57 | else if (!strcmp(name, "logo")) |
56 | cgit_logo = xstrdup(value); | 58 | cgit_logo = xstrdup(value); |
57 | else if (!strcmp(name, "logo-link")) | 59 | else if (!strcmp(name, "logo-link")) |
58 | cgit_logo_link = xstrdup(value); | 60 | cgit_logo_link = xstrdup(value); |
59 | else if (!strcmp(name, "virtual-root")) | 61 | else if (!strcmp(name, "virtual-root")) |
60 | cgit_virtual_root = xstrdup(value); | 62 | cgit_virtual_root = xstrdup(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 | ||
85 | void cgit_querystring_cb(const char *name, const char *value) | 89 | void cgit_querystring_cb(const char *name, const char *value) |
86 | { | 90 | { |
87 | if (!strcmp(name,"r")) { | 91 | if (!strcmp(name,"r")) { |
88 | cgit_query_repo = xstrdup(value); | 92 | cgit_query_repo = xstrdup(value); |
89 | } else if (!strcmp(name, "p")) { | 93 | } else if (!strcmp(name, "p")) { |
90 | cgit_query_page = xstrdup(value); | 94 | cgit_query_page = xstrdup(value); |
91 | } else if (!strcmp(name, "q")) { | 95 | } else if (!strcmp(name, "q")) { |
92 | cgit_query_search = xstrdup(value); | 96 | cgit_query_search = xstrdup(value); |
93 | } else if (!strcmp(name, "h")) { | 97 | } else if (!strcmp(name, "h")) { |
94 | cgit_query_head = xstrdup(value); | 98 | cgit_query_head = xstrdup(value); |
95 | cgit_query_has_symref = 1; | 99 | cgit_query_has_symref = 1; |
96 | } else if (!strcmp(name, "id")) { | 100 | } else if (!strcmp(name, "id")) { |
97 | cgit_query_sha1 = xstrdup(value); | 101 | cgit_query_sha1 = xstrdup(value); |
98 | cgit_query_has_sha1 = 1; | 102 | cgit_query_has_sha1 = 1; |
99 | } else if (!strcmp(name, "id2")) { | 103 | } else if (!strcmp(name, "id2")) { |
100 | cgit_query_sha2 = xstrdup(value); | 104 | cgit_query_sha2 = xstrdup(value); |
101 | cgit_query_has_sha1 = 1; | 105 | cgit_query_has_sha1 = 1; |
102 | } else if (!strcmp(name, "ofs")) { | 106 | } else if (!strcmp(name, "ofs")) { |
103 | cgit_query_ofs = atoi(value); | 107 | cgit_query_ofs = atoi(value); |
104 | } else if (!strcmp(name, "path")) { | 108 | } else if (!strcmp(name, "path")) { |
105 | cgit_query_path = xstrdup(value); | 109 | cgit_query_path = xstrdup(value); |
106 | } | 110 | } |
107 | } | 111 | } |
108 | 112 | ||
109 | void *cgit_free_commitinfo(struct commitinfo *info) | 113 | void *cgit_free_commitinfo(struct commitinfo *info) |
110 | { | 114 | { |
111 | free(info->author); | 115 | free(info->author); |
112 | free(info->author_email); | 116 | free(info->author_email); |
113 | free(info->committer); | 117 | free(info->committer); |
114 | free(info->committer_email); | 118 | free(info->committer_email); |
115 | free(info->subject); | 119 | free(info->subject); |
116 | free(info); | 120 | free(info); |
117 | return NULL; | 121 | return NULL; |
118 | } | 122 | } |
119 | 123 | ||
120 | int hextoint(char c) | 124 | int hextoint(char c) |