Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-07-06 21:54:45 +0300
committerJunio C Hamano <gitster@pobox.com>2023-07-06 21:54:45 +0300
commitda269af9207e38e820daad8aa993caa7d2fad76c (patch)
tree28567788ed00e6c037cb93684e95a473e3d2f412 /builtin/branch.c
parenta646b86cd10282de2ceb64ef33b5412e4fb2a54c (diff)
parent4416b86c6b34dad64b556bb1eb6711d5e6595a48 (diff)
Merge branch 'rs/strbuf-expand-step'
Code clean-up around strbuf_expand() API. * rs/strbuf-expand-step: strbuf: simplify strbuf_expand_literal_cb() replace strbuf_expand() with strbuf_expand_step() replace strbuf_expand_dict_cb() with strbuf_expand_step() strbuf: factor out strbuf_expand_step() pretty: factor out expand_separator()
Diffstat (limited to 'builtin/branch.c')
-rw-r--r--builtin/branch.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index b57e4c6e61..2fa7b2bd64 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -366,17 +366,8 @@ static const char *quote_literal_for_format(const char *s)
static struct strbuf buf = STRBUF_INIT;
strbuf_reset(&buf);
- while (*s) {
- const char *ep = strchrnul(s, '%');
- if (s < ep)
- strbuf_add(&buf, s, ep - s);
- if (*ep == '%') {
- strbuf_addstr(&buf, "%%");
- s = ep + 1;
- } else {
- s = ep;
- }
- }
+ while (strbuf_expand_step(&buf, &s))
+ strbuf_addstr(&buf, "%%");
return buf.buf;
}