diff options
author | Lars Hjemli <hjemli@gmail.com> | 2007-06-30 03:32:08 (JST) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-06-30 03:32:08 (JST) |
commit | 16a3d2779ccd56bf7954d98da547247d8796544b (patch) | |
tree | 86d2ed41adc3de842c7518d614ea49ca0200e4d2 /shared.c | |
parent | f69250358a74efa5d7d9c562b2cdd80fad1430f1 (diff) | |
parent | 103940fe6b0914dc42b8b033d1d328f38135ca5f (diff) | |
download | cgit-16a3d2779ccd56bf7954d98da547247d8796544b.zip cgit-16a3d2779ccd56bf7954d98da547247d8796544b.tar.gz |
Merge branch 'lh/menu'
* lh/menu:
Add ofs argument to cgit_log_link and use it in ui-log.c
Add trim_end() and use it to remove trailing slashes from repo paths
Do not include current path in the "tree" menu link
Add setting to enable/disable extra links on index page
Change S/L/T to summary/log/tree
Change "files" to "tree"
Include querystring as part of cached filename for repo summary page
Add more menuitems on repo pages
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 | { |