summaryrefslogtreecommitdiffabout
path: root/shared.c
Unidiff
Diffstat (limited to 'shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--shared.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/shared.c b/shared.c
index f7f43b2..1a5b866 100644
--- a/shared.c
+++ b/shared.c
@@ -27,8 +27,9 @@ char *cgit_cache_root = "/var/cache/cgit";
27char *cgit_repo_group = NULL; 27char *cgit_repo_group = NULL;
28 28
29int cgit_nocache = 0; 29int cgit_nocache = 0;
30int cgit_snapshots = 0; 30int cgit_snapshots = 0;
31int cgit_enable_index_links = 0;
31int cgit_enable_log_filecount = 0; 32int cgit_enable_log_filecount = 0;
32int cgit_enable_log_linecount = 0; 33int cgit_enable_log_linecount = 0;
33int cgit_max_lock_attempts = 5; 34int cgit_max_lock_attempts = 5;
34int cgit_cache_root_ttl = 5; 35int cgit_cache_root_ttl = 5;
@@ -147,8 +148,10 @@ void cgit_global_config_cb(const char *name, const char *value)
147 else if (!strcmp(name, "nocache")) 148 else if (!strcmp(name, "nocache"))
148 cgit_nocache = atoi(value); 149 cgit_nocache = atoi(value);
149 else if (!strcmp(name, "snapshots")) 150 else if (!strcmp(name, "snapshots"))
150 cgit_snapshots = atoi(value); 151 cgit_snapshots = atoi(value);
152 else if (!strcmp(name, "enable-index-links"))
153 cgit_enable_index_links = atoi(value);
151 else if (!strcmp(name, "enable-log-filecount")) 154 else if (!strcmp(name, "enable-log-filecount"))
152 cgit_enable_log_filecount = atoi(value); 155 cgit_enable_log_filecount = atoi(value);
153 else if (!strcmp(name, "enable-log-linecount")) 156 else if (!strcmp(name, "enable-log-linecount"))
154 cgit_enable_log_linecount = atoi(value); 157 cgit_enable_log_linecount = atoi(value);
@@ -226,9 +229,9 @@ void cgit_querystring_cb(const char *name, const char *value)
226 cgit_query_has_sha1 = 1; 229 cgit_query_has_sha1 = 1;
227 } else if (!strcmp(name, "ofs")) { 230 } else if (!strcmp(name, "ofs")) {
228 cgit_query_ofs = atoi(value); 231 cgit_query_ofs = atoi(value);
229 } else if (!strcmp(name, "path")) { 232 } else if (!strcmp(name, "path")) {
230 cgit_query_path = xstrdup(value); 233 cgit_query_path = trim_end(value, '/');
231 } else if (!strcmp(name, "name")) { 234 } else if (!strcmp(name, "name")) {
232 cgit_query_name = xstrdup(value); 235 cgit_query_name = xstrdup(value);
233 } 236 }
234} 237}
@@ -255,8 +258,30 @@ int hextoint(char c)
255 else 258 else
256 return -1; 259 return -1;
257} 260}
258 261
262char *trim_end(const char *str, char c)
263{
264 int len;
265 char *s, *t;
266
267 if (str == NULL)
268 return NULL;
269 t = (char *)str;
270 len = strlen(t);
271 while(len > 0 && t[len - 1] == c)
272 len--;
273
274 if (len == 0)
275 return NULL;
276
277 c = t[len];
278 t[len] = '\0';
279 s = xstrdup(t);
280 t[len] = c;
281 return s;
282}
283
259void cgit_diff_tree_cb(struct diff_queue_struct *q, 284void cgit_diff_tree_cb(struct diff_queue_struct *q,
260 struct diff_options *options, void *data) 285 struct diff_options *options, void *data)
261{ 286{
262 int i; 287 int i;