avoid using sha1_to_hex output as printf format
authorJeff King <peff@peff.net>
Fri, 8 Jul 2016 10:35:15 +0000 (06:35 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Jul 2016 17:11:27 +0000 (10:11 -0700)
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/worktree.c
index e866844685d519e2406c050da497c42506077f7d..cce555cbbc8a58b41789990402d756d7d4aa337a 100644 (file)
@@ -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, "../..");