Skip to content

Commit

Permalink
diff --abbrev=<n> option fix.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Jan 28, 2006
1 parent f2d4227 commit 6b1ddbd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -847,8 +847,13 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
options->find_copies_harder = 1;
else if (!strcmp(arg, "--abbrev"))
options->abbrev = DEFAULT_ABBREV;
else if (!strncmp(arg, "--abbrev=", 9))
else if (!strncmp(arg, "--abbrev=", 9)) {
options->abbrev = strtoul(arg + 9, NULL, 10);
if (options->abbrev < MINIMUM_ABBREV)
options->abbrev = MINIMUM_ABBREV;
else if (40 < options->abbrev)
options->abbrev = 40;
}
else
return 0;
return 1;
Expand Down

0 comments on commit 6b1ddbd

Please sign in to comment.