about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorLukas Fleischer2014-12-13 11:40:48 +0100
committerJason A. Donenfeld2014-12-23 18:53:03 -0700
commit485b09925cd54f3f55257619fa5796d274e96050 (patch)
tree631b00ace022799631e89968bd865da7549d7fa1
parentgit: update to v2.2.1 (diff)
downloadcgit-485b09925cd54f3f55257619fa5796d274e96050.tar.gz
cgit-485b09925cd54f3f55257619fa5796d274e96050.zip
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 <cgit@cryptocrack.de>
-rw-r--r--scan-tree.c9
1 files 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)
123 strbuf_setlen(path, pathlen); 123 strbuf_setlen(path, pathlen);
124 } 124 }
125 125
126 if (ctx.cfg.remove_suffix) 126 if (ctx.cfg.remove_suffix) {
127 if ((p = strrchr(repo->url, '.')) && !strcmp(p, ".git")) 127 size_t urllen;
128 *p = '\0'; 128 strip_suffix(repo->url, ".git", &urllen);
129 strip_suffix_mem(repo->url, &urllen, "/");
130 repo->url[urllen] = '\0';
131 }
129 repo->path = xstrdup(path->buf); 132 repo->path = xstrdup(path->buf);
130 while (!repo->owner) { 133 while (!repo->owner) {
131 if ((pwd = getpwuid(st.st_uid)) == NULL) { 134 if ((pwd = getpwuid(st.st_uid)) == NULL) {