diff options
Diffstat (limited to 'shared.c')
-rw-r--r-- | shared.c | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -28,6 +28,7 @@ char *cgit_repo_group = NULL; | |||
28 | 28 | ||
29 | int cgit_nocache = 0; | 29 | int cgit_nocache = 0; |
30 | int cgit_snapshots = 0; | 30 | int cgit_snapshots = 0; |
31 | int cgit_enable_index_links = 0; | ||
31 | int cgit_enable_log_filecount = 0; | 32 | int cgit_enable_log_filecount = 0; |
32 | int cgit_enable_log_linecount = 0; | 33 | int cgit_enable_log_linecount = 0; |
33 | int cgit_max_lock_attempts = 5; | 34 | int cgit_max_lock_attempts = 5; |
@@ -148,6 +149,8 @@ void cgit_global_config_cb(const char *name, const char *value) | |||
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")) |
@@ -227,7 +230,7 @@ void cgit_querystring_cb(const char *name, const char *value) | |||
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 | } |
@@ -256,6 +259,28 @@ int hextoint(char c) | |||
256 | return -1; | 259 | return -1; |
257 | } | 260 | } |
258 | 261 | ||
262 | char *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 | |||
259 | void cgit_diff_tree_cb(struct diff_queue_struct *q, | 284 | void 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 | { |