Code

revert: do not pass non-literal string as format to git_path()
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Wed, 23 Nov 2011 12:45:36 +0000 (19:45 +0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Nov 2011 17:29:53 +0000 (09:29 -0800)
This fixes the following warning.

    CC builtin/revert.o
builtin/revert.c: In function ‘write_cherry_pick_head’:
builtin/revert.c:311: warning: format not a string literal and no format arguments

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/revert.c

index 0c61668b858671c4817e1445de01812fcc53f92d..9b9b2e57475ad201719d5d590c9e1be2d4d43401 100644 (file)
@@ -308,7 +308,7 @@ static void write_cherry_pick_head(struct commit *commit, const char *pseudoref)
 
        strbuf_addf(&buf, "%s\n", sha1_to_hex(commit->object.sha1));
 
-       filename = git_path(pseudoref);
+       filename = git_path("%s", pseudoref);
        fd = open(filename, O_WRONLY | O_CREAT, 0666);
        if (fd < 0)
                die_errno(_("Could not open '%s' for writing"), filename);