From: plenz at cis.fu-berlin.de (Julius Plenz)
Subject: [PATCH] Regression fix: Make section-from-path=-1 work again
Date: Tue, 16 Apr 2013 16:10:46 +0200 [thread overview]
Message-ID: <1366121446-970028-1-git-send-email-plenz@cis.fu-berlin.de> (raw)
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 <plenz at cis.fu-berlin.de>
---
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
next reply other threads:[~2013-04-16 14:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-16 14:10 plenz [this message]
2013-04-16 14:30 ` john
2013-04-16 14:50 ` plenz
2013-04-16 17:39 ` john
2013-04-17 11:38 ` plenz
2013-04-17 11:41 ` Jason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1366121446-970028-1-git-send-email-plenz@cis.fu-berlin.de \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).