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
This commit is contained in:
27
shared.c
27
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)
|
||||
{
|
||||
|
مرجع در شماره جدید
Block a user