1
0
mirror of https://github.com/git/git.git synced 2024-11-19 06:13:56 +01:00

rev-parse --abbrev: do not try abbrev shorter than minimum.

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>
This commit is contained in:
Junio C Hamano 2006-01-26 00:48:19 -08:00
parent b2d4c56f2f
commit 1dc4fb84b5

@ -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")) {