Skip to content

Commit

Permalink
Disallow invalid --pretty= abbreviations
Browse files Browse the repository at this point in the history
--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>
  • Loading branch information
Eric Wong authored and Junio C Hamano committed Feb 3, 2007
1 parent aacd404 commit b693620
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit b693620

Please sign in to comment.