summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c3
-rw-r--r--cgit.h1
-rw-r--r--cgitrc.5.txt6
-rw-r--r--scan-tree.c3
4 files changed, 13 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index 2364d1c..f9a42bb 100644
--- a/cgit.c
+++ b/cgit.c
@@ -206,4 +206,6 @@ void config_cb(const char *name, const char *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);
@@ -303,4 +305,5 @@ static void prepare_context(struct cgit_context *ctx)
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";
diff --git a/cgit.h b/cgit.h
index 4591f8c..ada8535 100644
--- a/cgit.h
+++ b/cgit.h
@@ -203,4 +203,5 @@ struct cgit_config {
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;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index ec004d4..6fb1083 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -230,4 +230,9 @@ project-list::
230 scan-path. Default value: none. See also: scan-path. 230 scan-path. Default value: none. See also: scan-path.
231 231
232remove-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
232renamelimit:: 237renamelimit::
233 Maximum number of files to consider when detecting renames. The value 238 Maximum number of files to consider when detecting renames. The value
@@ -539,2 +544,3 @@ AUTHOR
539------ 544------
540Lars Hjemli <hjemli@gmail.com> 545Lars Hjemli <hjemli@gmail.com>
546Jason 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
@@ -82,4 +82,7 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn)
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);