summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rev-parse.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/rev-parse.c b/rev-parse.c
index 42969a6..8bf316e 100644
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -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")) {