From 2e4a941626c240bc7858aa7564882c01f657f4e8 Mon Sep 17 00:00:00 2001 From: Jason A. Donenfeld Date: Thu, 29 Jul 2010 19:47:50 +0200 Subject: Add support for 'remove-suffix' option When this option is enabled, the '.git' suffix of repository directories found while processing the 'scan-path' option will be removed. Signed-off-by: Jason A. Donenfeld Signed-off-by: Lars Hjemli --- scan-tree.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scan-tree.c') diff --git a/scan-tree.c b/scan-tree.c index 9bf9b38..a83a78c 100644 --- a/scan-tree.c +++ b/scan-tree.c @@ -81,6 +81,9 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn) p[strlen(p) - 5] = '\0'; repo = cgit_add_repo(xstrdup(p)); + if (ctx.cfg.remove_suffix) + if ((p = strrchr(repo->url, '.')) && !strcmp(p, ".git")) + *p = '\0'; repo->name = repo->url; repo->path = xstrdup(path); p = (pwd && pwd->pw_gecos) ? strchr(pwd->pw_gecos, ',') : NULL; -- cgit v1.2.3-70-g09d2