From mboxrd@z Thu Jan 1 00:00:00 1970 From: plenz at cis.fu-berlin.de (Julius Plenz) Date: Tue, 16 Apr 2013 16:10:46 +0200 Subject: [PATCH] Regression fix: Make section-from-path=-1 work again Message-ID: <1366121446-970028-1-git-send-email-plenz@cis.fu-berlin.de> This fixes a regression introduced in commit fb3655df, "use struct strbuf instead of static buffers": > The pattern there is to append the filename, use it and then reset > the buffer to its original length (retaining a trailing '/'). This makes the "count slashes from end of string" fail. My workaround is to start counting only before the trailing slash. Signed-off-by: Julius Plenz --- scan-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scan-tree.c b/scan-tree.c index beb584b..53f949b 100644 --- a/scan-tree.c +++ b/scan-tree.c @@ -158,7 +158,7 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn) while (slash && n && (slash = strchr(slash, '/'))) n--; } else { - slash = rel.buf + rel.len; + slash = rel.buf + rel.len - 2; while (slash && n && (slash = xstrrchr(rel.buf, slash, '/'))) n++; } -- 1.8.2.1-zedat