From mboxrd@z Thu Jan 1 00:00:00 1970 From: cgit at cryptocrack.de (Lukas Fleischer) Date: Sat, 13 Dec 2014 12:01:22 +0100 Subject: [PATCH] Remove trailing slash after remove-suffix In-Reply-To: <53640519.166708.1418460094104.JavaMail.yahoo@jws10604.mail.bf1.yahoo.com> References: <53640519.166708.1418460094104.JavaMail.yahoo@jws10604.mail.bf1.yahoo.com> Message-ID: <1418468482-7056-1-git-send-email-cgit@cryptocrack.de> When removing the ".git" suffix of a non-bare repository, also remove the trailing slash for compatibility with cgit_repobasename(). Signed-off-by: Lukas Fleischer --- scan-tree.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scan-tree.c b/scan-tree.c index 044bcdc..41e9264 100644 --- a/scan-tree.c +++ b/scan-tree.c @@ -123,9 +123,12 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn) strbuf_setlen(path, pathlen); } - if (ctx.cfg.remove_suffix) + if (ctx.cfg.remove_suffix) { if ((p = strrchr(repo->url, '.')) && !strcmp(p, ".git")) *p = '\0'; + if (*(--p) == '/'); + *p = '\0'; + } repo->path = xstrdup(path->buf); while (!repo->owner) { if ((pwd = getpwuid(st.st_uid)) == NULL) { -- 2.1.3