diff --abbrev=<n> option fix.
Earier specifying an abbreviation shorter than minimum fell back to full 40 letters, which was nonsense. Make it to fall back to the minimum number (currently 4). Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jan 27, 2006 at 02:19 UTC
6b1ddbdd6e02719ae2be55dc141a176187e5027e
1 file changed
+6
-1
diff.c
+6
-1
@@ -847,8 +847,13 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
847
options->find_copies_harder = 1;
848
else if (!strcmp(arg, "--abbrev"))
849
options->abbrev = DEFAULT_ABBREV;
850
- else if (!strncmp(arg, "--abbrev=", 9))
850
+ else if (!strncmp(arg, "--abbrev=", 9)) {
851
options->abbrev = strtoul(arg + 9, NULL, 10);
852
+ if (options->abbrev < MINIMUM_ABBREV)
853
+ options->abbrev = MINIMUM_ABBREV;
854
+ else if (40 < options->abbrev)
855
+ options->abbrev = 40;
856
+ }
857
else
858
return 0;
859
return 1;