From 485b09925cd54f3f55257619fa5796d274e96050 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sat, 13 Dec 2014 11:40:48 +0100 Subject: Remove trailing slash after remove-suffix 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scan-tree.c b/scan-tree.c index 044bcdc..e900ad9 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 ((p = strrchr(repo->url, '.')) && !strcmp(p, ".git")) - *p = '\0'; + if (ctx.cfg.remove_suffix) { + size_t urllen; + strip_suffix(repo->url, ".git", &urllen); + strip_suffix_mem(repo->url, &urllen, "/"); + repo->url[urllen] = '\0'; + } repo->path = xstrdup(path->buf); while (!repo->owner) { if ((pwd = getpwuid(st.st_uid)) == NULL) { -- cgit 1.4.1 st/'>summary refs log tree commit diff
Commit message (Expand)Author
2018-09-11Add /help equivalent to /manJune McEnroe
2018-09-11Don't render every PM as a pingJune McEnroe
2018-09-11Add urlOpenMatchJune McEnroe
2018-09-10Depend on man.sh for chroot.tar targetJune McEnroe
2018-09-10Set LESSSECURE=1 in man.shJune McEnroe
2018-09-10Add /man commandJune McEnroe
2018-09-10Install man page in chrootJune McEnroe
2018-09-10Install man pageJune McEnroe
2018-09-10Split keys into subsections and document colorsJune McEnroe
2018-09-10Add "blank" lines to chatte.1June McEnroe
2018-09-10Document key bindings in chatte.1June McEnroe
2018-09-08Document slash commands in chatte.1June McEnroe