aboutsummaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-01-27 02:19:51 -0800
committerJunio C Hamano <junkio@cox.net>2006-01-28 00:09:39 -0800
commit6b1ddbdd6e02719ae2be55dc141a176187e5027e (patch)
tree31f15265904ed267d2d61889127da48c29b2642e /diff.c
parentf2d4227530499db3e273ae84f30adfd4b70791c6 (diff)
downloadgit-6b1ddbdd6e02719ae2be55dc141a176187e5027e.tar.gz
git-6b1ddbdd6e02719ae2be55dc141a176187e5027e.tar.xz
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>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index 69767b9de..8ae6dbc64 100644
--- a/diff.c
+++ b/diff.c
@@ -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;