X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/4b91269bdbc21a664cc56c26d6071c630560f2e0..e14eee9ea573a17c9501d1020fc869218aac9e8a:/scan-tree.c 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) {