Skip to content

Commit

Permalink
rev-parse --abbrev: do not try abbrev shorter than minimum.
Browse files Browse the repository at this point in the history
We do not allow abbreviation shorter than 4 letters in other
parts of the system so do not attempt to generate such.

Noticed by Uwe Zeisberger.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Jan 28, 2006
1 parent b2d4c56 commit 1dc4fb8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rev-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,10 @@ int main(int argc, char **argv)
abbrev = DEFAULT_ABBREV;
if (arg[8] == '=')
abbrev = strtoul(arg + 9, NULL, 10);
if (abbrev < 0 || 40 <= abbrev)
abbrev = DEFAULT_ABBREV;
if (abbrev < MINIMUM_ABBREV)
abbrev = MINIMUM_ABBREV;
else if (40 <= abbrev)
abbrev = 40;
continue;
}
if (!strcmp(arg, "--sq")) {
Expand Down

0 comments on commit 1dc4fb8

Please sign in to comment.