summaryrefslogtreecommitdiff
path: root/parse-options-cb.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-03-24 08:20:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-03-24 13:21:22 (GMT)
commitd877418390168c9696fd46d5e78ca3362f26f74c (patch)
tree822a8c0457a95d8b171689c528d98036198eba87 /parse-options-cb.c
parentd2d3f27300967e76e0c9f3a916e7e236ff95f1aa (diff)
downloadgit-d877418390168c9696fd46d5e78ca3362f26f74c.zip
git-d877418390168c9696fd46d5e78ca3362f26f74c.tar.gz
git-d877418390168c9696fd46d5e78ca3362f26f74c.tar.bz2
diff-parseopt: convert --[no-]abbrev
OPT__ABBREV() has the same behavior as the deleted code with one difference: it does check for valid number and error out if not. And the '40' change is self explanatory. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options-cb.c')
-rw-r--r--parse-options-cb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/parse-options-cb.c b/parse-options-cb.c
index 2733393..6e2e8d6 100644
--- a/parse-options-cb.c
+++ b/parse-options-cb.c
@@ -22,8 +22,8 @@ int parse_opt_abbrev_cb(const struct option *opt, const char *arg, int unset)
opt->long_name);
if (v && v < MINIMUM_ABBREV)
v = MINIMUM_ABBREV;
- else if (v > 40)
- v = 40;
+ else if (v > the_hash_algo->hexsz)
+ v = the_hash_algo->hexsz;
}
*(int *)(opt->value) = v;
return 0;