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
@@ -204,8 +204,10 @@ void config_cb(const char *name, const char *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);
@@ -301,8 +303,9 @@ static void prepare_context(struct cgit_context *ctx)
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;
diff --git a/cgit.h b/cgit.h
index 4591f8c..ada8535 100644
--- a/cgit.h
+++ b/cgit.h
@@ -201,8 +201,9 @@ struct cgit_config {
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;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index ec004d4..6fb1083 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -228,8 +228,13 @@ 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
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
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".
@@ -537,4 +542,5 @@ will generate the following html element:
537 542
538AUTHOR 543AUTHOR
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
@@ -80,8 +80,11 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn)
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)