|
diff --git a/shared.c b/shared.c index 752ceac..53cd9b0 100644 --- a/ shared.c+++ b/ shared.c |
|
@@ -19,12 +19,14 @@ char *cgit_module_link = "./?repo=%s&page=commit&id=%s"; |
19 | char *cgit_virtual_root = NULL; |
19 | char *cgit_virtual_root = NULL; |
20 | char *cgit_script_name = CGIT_SCRIPT_NAME; |
20 | char *cgit_script_name = CGIT_SCRIPT_NAME; |
21 | char *cgit_cache_root = "/var/cache/cgit"; |
21 | char *cgit_cache_root = "/var/cache/cgit"; |
22 | |
22 | |
23 | int cgit_nocache = 0; |
23 | int cgit_nocache = 0; |
24 | int cgit_snapshots = 0; |
24 | int cgit_snapshots = 0; |
| |
25 | int cgit_enable_log_filecount = 0; |
| |
26 | int cgit_enable_log_linecount = 0; |
25 | int cgit_max_lock_attempts = 5; |
27 | int cgit_max_lock_attempts = 5; |
26 | int cgit_cache_root_ttl = 5; |
28 | int cgit_cache_root_ttl = 5; |
27 | int cgit_cache_repo_ttl = 5; |
29 | int cgit_cache_repo_ttl = 5; |
28 | int cgit_cache_dynamic_ttl = 5; |
30 | int cgit_cache_dynamic_ttl = 5; |
29 | int cgit_cache_static_ttl = -1; |
31 | int cgit_cache_static_ttl = -1; |
30 | int cgit_cache_max_create_time = 5; |
32 | int cgit_cache_max_create_time = 5; |
@@ -82,12 +84,14 @@ struct repoinfo *add_repo(const char *url) |
82 | ret->name = ret->url; |
84 | ret->name = ret->url; |
83 | ret->path = NULL; |
85 | ret->path = NULL; |
84 | ret->desc = NULL; |
86 | ret->desc = NULL; |
85 | ret->owner = NULL; |
87 | ret->owner = NULL; |
86 | ret->defbranch = "master"; |
88 | ret->defbranch = "master"; |
87 | ret->snapshots = cgit_snapshots; |
89 | ret->snapshots = cgit_snapshots; |
| |
90 | ret->enable_log_filecount = cgit_enable_log_filecount; |
| |
91 | ret->enable_log_linecount = cgit_enable_log_linecount; |
88 | ret->module_link = cgit_module_link; |
92 | ret->module_link = cgit_module_link; |
89 | return ret; |
93 | return ret; |
90 | } |
94 | } |
91 | |
95 | |
92 | void cgit_global_config_cb(const char *name, const char *value) |
96 | void cgit_global_config_cb(const char *name, const char *value) |
93 | { |
97 | { |
@@ -104,12 +108,16 @@ void cgit_global_config_cb(const char *name, const char *value) |
104 | else if (!strcmp(name, "virtual-root")) |
108 | else if (!strcmp(name, "virtual-root")) |
105 | cgit_virtual_root = xstrdup(value); |
109 | cgit_virtual_root = xstrdup(value); |
106 | else if (!strcmp(name, "nocache")) |
110 | else if (!strcmp(name, "nocache")) |
107 | cgit_nocache = atoi(value); |
111 | cgit_nocache = atoi(value); |
108 | else if (!strcmp(name, "snapshots")) |
112 | else if (!strcmp(name, "snapshots")) |
109 | cgit_snapshots = atoi(value); |
113 | cgit_snapshots = atoi(value); |
| |
114 | else if (!strcmp(name, "enable-log-filecount")) |
| |
115 | cgit_enable_log_filecount = atoi(value); |
| |
116 | else if (!strcmp(name, "enable-log-linecount")) |
| |
117 | cgit_enable_log_linecount = atoi(value); |
110 | else if (!strcmp(name, "cache-root")) |
118 | else if (!strcmp(name, "cache-root")) |
111 | cgit_cache_root = xstrdup(value); |
119 | cgit_cache_root = xstrdup(value); |
112 | else if (!strcmp(name, "cache-root-ttl")) |
120 | else if (!strcmp(name, "cache-root-ttl")) |
113 | cgit_cache_root_ttl = atoi(value); |
121 | cgit_cache_root_ttl = atoi(value); |
114 | else if (!strcmp(name, "cache-repo-ttl")) |
122 | else if (!strcmp(name, "cache-repo-ttl")) |
115 | cgit_cache_repo_ttl = atoi(value); |
123 | cgit_cache_repo_ttl = atoi(value); |
@@ -133,13 +141,17 @@ void cgit_global_config_cb(const char *name, const char *value) |
133 | cgit_repo->desc = xstrdup(value); |
141 | cgit_repo->desc = xstrdup(value); |
134 | else if (cgit_repo && !strcmp(name, "repo.owner")) |
142 | else if (cgit_repo && !strcmp(name, "repo.owner")) |
135 | cgit_repo->owner = xstrdup(value); |
143 | cgit_repo->owner = xstrdup(value); |
136 | else if (cgit_repo && !strcmp(name, "repo.defbranch")) |
144 | else if (cgit_repo && !strcmp(name, "repo.defbranch")) |
137 | cgit_repo->defbranch = xstrdup(value); |
145 | cgit_repo->defbranch = xstrdup(value); |
138 | else if (cgit_repo && !strcmp(name, "repo.snapshots")) |
146 | else if (cgit_repo && !strcmp(name, "repo.snapshots")) |
139 | cgit_repo->snapshots = atoi(value); |
147 | cgit_repo->snapshots = cgit_snapshots * atoi(value); |
| |
148 | else if (cgit_repo && !strcmp(name, "repo.enable-log-filecount")) |
| |
149 | cgit_repo->enable_log_filecount = cgit_enable_log_filecount * atoi(value); |
| |
150 | else if (cgit_repo && !strcmp(name, "repo.enable-log-linecount")) |
| |
151 | cgit_repo->enable_log_linecount = cgit_enable_log_linecount * atoi(value); |
140 | else if (cgit_repo && !strcmp(name, "repo.module-link")) |
152 | else if (cgit_repo && !strcmp(name, "repo.module-link")) |
141 | cgit_repo->module_link= xstrdup(value); |
153 | cgit_repo->module_link= xstrdup(value); |
142 | else if (!strcmp(name, "include")) |
154 | else if (!strcmp(name, "include")) |
143 | cgit_read_config(value, cgit_global_config_cb); |
155 | cgit_read_config(value, cgit_global_config_cb); |
144 | } |
156 | } |
145 | |
157 | |
|