From: Jeff King Date: Fri, 8 Jul 2016 10:35:15 +0000 (-0400) Subject: avoid using sha1_to_hex output as printf format X-Git-Tag: v2.10.0-rc0~103^2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/dabd35f4cdd8bcfa502d082da5a3e4b927a2b329 avoid using sha1_to_hex output as printf format We know that it should not contain any percent-signs, but it's a good habit not to feed non-literals to printf formatters. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/builtin/worktree.c b/builtin/worktree.c index e866844685..cce555cbbc 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -262,7 +262,7 @@ static int add_worktree(const char *path, const char *refname, */ strbuf_reset(&sb); strbuf_addf(&sb, "%s/HEAD", sb_repo.buf); - write_file(sb.buf, sha1_to_hex(null_sha1)); + write_file(sb.buf, "%s", sha1_to_hex(null_sha1)); strbuf_reset(&sb); strbuf_addf(&sb, "%s/commondir", sb_repo.buf); write_file(sb.buf, "../..");