-rw-r--r-- | cgit.c | 3 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc.5.txt | 6 | ||||
-rw-r--r-- | scan-tree.c | 3 |
4 files changed, 13 insertions, 0 deletions
@@ -202,12 +202,14 @@ void config_cb(const char *name, const char *value) | |||
202 | else if (!strcmp(name, "side-by-side-diffs")) | 202 | else if (!strcmp(name, "side-by-side-diffs")) |
203 | ctx.cfg.ssdiff = atoi(value); | 203 | ctx.cfg.ssdiff = atoi(value); |
204 | else if (!strcmp(name, "agefile")) | 204 | else if (!strcmp(name, "agefile")) |
205 | ctx.cfg.agefile = xstrdup(value); | 205 | ctx.cfg.agefile = xstrdup(value); |
206 | else if (!strcmp(name, "renamelimit")) | 206 | else if (!strcmp(name, "renamelimit")) |
207 | ctx.cfg.renamelimit = atoi(value); | 207 | ctx.cfg.renamelimit = atoi(value); |
208 | else if (!strcmp(name, "remove-suffix")) | ||
209 | ctx.cfg.remove_suffix = atoi(value); | ||
208 | else if (!strcmp(name, "robots")) | 210 | else if (!strcmp(name, "robots")) |
209 | ctx.cfg.robots = xstrdup(value); | 211 | ctx.cfg.robots = xstrdup(value); |
210 | else if (!strcmp(name, "clone-prefix")) | 212 | else if (!strcmp(name, "clone-prefix")) |
211 | ctx.cfg.clone_prefix = xstrdup(value); | 213 | ctx.cfg.clone_prefix = xstrdup(value); |
212 | else if (!strcmp(name, "local-time")) | 214 | else if (!strcmp(name, "local-time")) |
213 | ctx.cfg.local_time = atoi(value); | 215 | ctx.cfg.local_time = atoi(value); |
@@ -299,12 +301,13 @@ static void prepare_context(struct cgit_context *ctx) | |||
299 | ctx->cfg.max_repodesc_len = 80; | 301 | ctx->cfg.max_repodesc_len = 80; |
300 | ctx->cfg.max_blob_size = 0; | 302 | ctx->cfg.max_blob_size = 0; |
301 | ctx->cfg.max_stats = 0; | 303 | ctx->cfg.max_stats = 0; |
302 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; | 304 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
303 | ctx->cfg.project_list = NULL; | 305 | ctx->cfg.project_list = NULL; |
304 | ctx->cfg.renamelimit = -1; | 306 | ctx->cfg.renamelimit = -1; |
307 | ctx->cfg.remove_suffix = 0; | ||
305 | ctx->cfg.robots = "index, nofollow"; | 308 | ctx->cfg.robots = "index, nofollow"; |
306 | ctx->cfg.root_title = "Git repository browser"; | 309 | ctx->cfg.root_title = "Git repository browser"; |
307 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; | 310 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; |
308 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; | 311 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; |
309 | ctx->cfg.section = ""; | 312 | ctx->cfg.section = ""; |
310 | ctx->cfg.summary_branches = 10; | 313 | ctx->cfg.summary_branches = 10; |
@@ -199,12 +199,13 @@ struct cgit_config { | |||
199 | int max_blob_size; | 199 | int max_blob_size; |
200 | int max_stats; | 200 | int max_stats; |
201 | int nocache; | 201 | int nocache; |
202 | int noplainemail; | 202 | int noplainemail; |
203 | int noheader; | 203 | int noheader; |
204 | int renamelimit; | 204 | int renamelimit; |
205 | int remove_suffix; | ||
205 | int snapshots; | 206 | int snapshots; |
206 | int summary_branches; | 207 | int summary_branches; |
207 | int summary_log; | 208 | int summary_log; |
208 | int summary_tags; | 209 | int summary_tags; |
209 | int ssdiff; | 210 | int ssdiff; |
210 | struct string_list mimetypes; | 211 | struct string_list mimetypes; |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index ec004d4..6fb1083 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -226,12 +226,17 @@ noheader:: | |||
226 | 226 | ||
227 | project-list:: | 227 | project-list:: |
228 | A list of subdirectories inside of scan-path, relative to it, that | 228 | A list of subdirectories inside of scan-path, relative to it, that |
229 | should loaded as git repositories. This must be defined prior to | 229 | should loaded as git repositories. This must be defined prior to |
230 | scan-path. Default value: none. See also: scan-path. | 230 | scan-path. Default value: none. See also: scan-path. |
231 | 231 | ||
232 | remove-suffix:: | ||
233 | If set to "1" and scan-path is enabled, if any repositories are found | ||
234 | with a suffix of ".git", this suffix will be removed for the url and | ||
235 | name. Default value: "0". See also: scan-path. | ||
236 | |||
232 | renamelimit:: | 237 | renamelimit:: |
233 | Maximum number of files to consider when detecting renames. The value | 238 | Maximum number of files to consider when detecting renames. The value |
234 | "-1" uses the compiletime value in git (for further info, look at | 239 | "-1" uses the compiletime value in git (for further info, look at |
235 | `man git-diff`). Default value: "-1". | 240 | `man git-diff`). Default value: "-1". |
236 | 241 | ||
237 | repo.group:: | 242 | repo.group:: |
@@ -535,6 +540,7 @@ will generate the following html element: | |||
535 | 540 | ||
536 | 541 | ||
537 | 542 | ||
538 | AUTHOR | 543 | AUTHOR |
539 | ------ | 544 | ------ |
540 | Lars Hjemli <hjemli@gmail.com> | 545 | Lars Hjemli <hjemli@gmail.com> |
546 | Jason A. Donenfeld <Jason@zx2c4.com> | ||
diff --git a/scan-tree.c b/scan-tree.c index 9bf9b38..a83a78c 100644 --- a/scan-tree.c +++ b/scan-tree.c | |||
@@ -78,12 +78,15 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn) | |||
78 | p = fmt("%s", path + strlen(base) + 1); | 78 | p = fmt("%s", path + strlen(base) + 1); |
79 | 79 | ||
80 | if (!strcmp(p + strlen(p) - 5, "/.git")) | 80 | if (!strcmp(p + strlen(p) - 5, "/.git")) |
81 | p[strlen(p) - 5] = '\0'; | 81 | p[strlen(p) - 5] = '\0'; |
82 | 82 | ||
83 | repo = cgit_add_repo(xstrdup(p)); | 83 | repo = cgit_add_repo(xstrdup(p)); |
84 | if (ctx.cfg.remove_suffix) | ||
85 | if ((p = strrchr(repo->url, '.')) && !strcmp(p, ".git")) | ||
86 | *p = '\0'; | ||
84 | repo->name = repo->url; | 87 | repo->name = repo->url; |
85 | repo->path = xstrdup(path); | 88 | repo->path = xstrdup(path); |
86 | p = (pwd && pwd->pw_gecos) ? strchr(pwd->pw_gecos, ',') : NULL; | 89 | p = (pwd && pwd->pw_gecos) ? strchr(pwd->pw_gecos, ',') : NULL; |
87 | if (p) | 90 | if (p) |
88 | *p = '\0'; | 91 | *p = '\0'; |
89 | repo->owner = (pwd ? xstrdup(pwd->pw_gecos ? pwd->pw_gecos : pwd->pw_name) : ""); | 92 | repo->owner = (pwd ? xstrdup(pwd->pw_gecos ? pwd->pw_gecos : pwd->pw_name) : ""); |