diff options
author | John Keeping | 2013-04-16 18:39:58 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2013-04-17 13:40:16 +0200 |
commit | 9a725f4f0991710336584bb284a83dcf5fa5bf1e (patch) | |
tree | 6087786d97c50ae613b1ccd6c4195d9766aff42e | |
parent | d483e8f5692117d6f3ea0801c0ca2ec7aa8f6f3b (diff) | |
download | cgit-9a725f4f0991710336584bb284a83dcf5fa5bf1e.tar.gz |
scan-tree: fix regression in section-from-path=-1
Commit fb3655d (use struct strbuf instead of static buffers -
2013-04-06) introduced a regression in the "section-from-path" handling
when the configured value is negative. By changing the "rel" variable
so that it includes a trailing slash, counting slashes from the end of
the string no longer gives the same answer as it did before.
Fix this by ensuring that "rel" does not have a trailing slash.
Reported-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: John Keeping <john@keeping.me.uk>
-rw-r--r-- | scan-tree.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/scan-tree.c b/scan-tree.c index beb584b..a1ec8fb 100644 --- a/scan-tree.c +++ b/scan-tree.c @@ -113,6 +113,8 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn) if (!strcmp(rel.buf + rel.len - 5, "/.git")) strbuf_setlen(&rel, rel.len - 5); + else if (rel.len && rel.buf[rel.len - 1] == '/') + strbuf_setlen(&rel, rel.len - 1); repo = cgit_add_repo(rel.buf); config_fn = fn; |