]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Disallow invalid --pretty= abbreviations
authorEric Wong <normalperson@yhbt.net>
Fri, 2 Feb 2007 13:10:25 +0000 (05:10 -0800)
committerJunio C Hamano <junkio@cox.net>
Sat, 3 Feb 2007 05:18:59 +0000 (21:18 -0800)
--pretty=o is a valid abbreviation, --pretty=omfg is not

Noticed by: Nicolas Vilz
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
commit.c

index 9b2b842e7dcc153a12b35394a2e3f88f146b6225..3e8c87294bc9e0cdbab40d485f75e3980ae4ff10 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -47,7 +47,8 @@ enum cmit_fmt get_commit_format(const char *arg)
        if (*arg == '=')
                arg++;
        for (i = 0; i < ARRAY_SIZE(cmt_fmts); i++) {
-               if (!strncmp(arg, cmt_fmts[i].n, cmt_fmts[i].cmp_len))
+               if (!strncmp(arg, cmt_fmts[i].n, cmt_fmts[i].cmp_len) &&
+                   !strncmp(arg, cmt_fmts[i].n, strlen(arg)))
                        return cmt_fmts[i].v;
        }