commit: use strbuf_add() to add a length-limited string
This is shorter and simpler. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Dec 7, 2019 at 12:16 UTC
147ee35558a300a7e51af5335ef59b09fd57ab7c
1 file changed
+1
-1
builtin/commit.c
+1
-1
@@ -534,7 +534,7 @@ static void export_one(const char *var, const char *s, const char *e, int hack)
534
struct strbuf buf = STRBUF_INIT;
535
if (hack)
536
strbuf_addch(&buf, hack);
537
- strbuf_addf(&buf, "%.*s", (int)(e - s), s);
537
+ strbuf_add(&buf, s, e - s);
538
setenv(var, buf.buf, 1);
539
strbuf_release(&buf);
540
}