Skip to content

Commit b693620

Browse files
Eric WongJunio C Hamano
authored andcommitted
Disallow invalid --pretty= abbreviations
--pretty=o is a valid abbreviation, --pretty=omfg is not Noticed by: Nicolas Vilz Signed-off-by: Eric Wong <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aacd404 commit b693620

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

commit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ enum cmit_fmt get_commit_format(const char *arg)
4747
if (*arg == '=')
4848
arg++;
4949
for (i = 0; i < ARRAY_SIZE(cmt_fmts); i++) {
50-
if (!strncmp(arg, cmt_fmts[i].n, cmt_fmts[i].cmp_len))
50+
if (!strncmp(arg, cmt_fmts[i].n, cmt_fmts[i].cmp_len) &&
51+
!strncmp(arg, cmt_fmts[i].n, strlen(arg)))
5152
return cmt_fmts[i].v;
5253
}
5354

0 commit comments

Comments
 (0)