From b6936205e73c058784288d21d1937e5bba26b91b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 2 Feb 2007 05:10:25 -0800 Subject: [PATCH] Disallow invalid --pretty= abbreviations --pretty=o is a valid abbreviation, --pretty=omfg is not Noticed by: Nicolas Vilz Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- commit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commit.c b/commit.c index 9b2b842e7..3e8c87294 100644 --- 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; } -- 2.30.2