aboutsummaryrefslogtreecommitdiffstats
path: root/shared.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2007-06-29 20:32:08 +0200
committerLars Hjemli <hjemli@gmail.com>2007-06-29 20:32:08 +0200
commit16a3d2779ccd56bf7954d98da547247d8796544b (patch)
tree86d2ed41adc3de842c7518d614ea49ca0200e4d2 /shared.c
parentf69250358a74efa5d7d9c562b2cdd80fad1430f1 (diff)
parent103940fe6b0914dc42b8b033d1d328f38135ca5f (diff)
downloadcgit-16a3d2779ccd56bf7954d98da547247d8796544b.tar.gz
cgit-16a3d2779ccd56bf7954d98da547247d8796544b.tar.bz2
cgit-16a3d2779ccd56bf7954d98da547247d8796544b.zip
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.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
@@ -28,6 +28,7 @@ char *cgit_repo_group = NULL;
int cgit_nocache = 0;
int cgit_snapshots = 0;
+int cgit_enable_index_links = 0;
int cgit_enable_log_filecount = 0;
int cgit_enable_log_linecount = 0;
int cgit_max_lock_attempts = 5;
@@ -148,6 +149,8 @@ void cgit_global_config_cb(const char *name, const char *value)
cgit_nocache = atoi(value);
else if (!strcmp(name, "snapshots"))
cgit_snapshots = atoi(value);
+ else if (!strcmp(name, "enable-index-links"))
+ cgit_enable_index_links = atoi(value);
else if (!strcmp(name, "enable-log-filecount"))
cgit_enable_log_filecount = atoi(value);
else if (!strcmp(name, "enable-log-linecount"))
@@ -227,7 +230,7 @@ void cgit_querystring_cb(const char *name, const char *value)
} else if (!strcmp(name, "ofs")) {
cgit_query_ofs = atoi(value);
} else if (!strcmp(name, "path")) {
- cgit_query_path = xstrdup(value);
+ cgit_query_path = trim_end(value, '/');
} else if (!strcmp(name, "name")) {
cgit_query_name = xstrdup(value);
}
@@ -256,6 +259,28 @@ int hextoint(char c)
return -1;
}
+char *trim_end(const char *str, char c)
+{
+ int len;
+ char *s, *t;
+
+ if (str == NULL)
+ return NULL;
+ t = (char *)str;
+ len = strlen(t);
+ while(len > 0 && t[len - 1] == c)
+ len--;
+
+ if (len == 0)
+ return NULL;
+
+ c = t[len];
+ t[len] = '\0';
+ s = xstrdup(t);
+ t[len] = c;
+ return s;
+}
+
void cgit_diff_tree_cb(struct diff_queue_struct *q,
struct diff_options *options, void *data)
{