-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
@@ -207,2 +207,4 @@ void config_cb(const char *name, const char *value) | |||
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")) |
@@ -304,2 +306,3 @@ static void prepare_context(struct cgit_context *ctx) | |||
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"; |
@@ -204,2 +204,3 @@ struct cgit_config { | |||
204 | int renamelimit; | 204 | int renamelimit; |
205 | int remove_suffix; | ||
205 | int snapshots; | 206 | int snapshots; |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index ec004d4..6fb1083 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -231,2 +231,7 @@ project-list:: | |||
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:: |
@@ -540 +545,2 @@ AUTHOR | |||
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 | |||
@@ -83,2 +83,5 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn) | |||
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; |