Junio C Hamano <gitster@xxxxxxxxx> writes: > There still are breakages seen in t5510 and t5526 that are about the > verbose output of "git fetch". I'll stop digging at this point > tonight, and welcome others who look into it ;-) OK, just before I leave the keyboard for the night... -- >8 -- From: Junio C Hamano <gitster@xxxxxxxxx> Date: Thu, 29 Sep 2016 21:19:20 -0700 Subject: [PATCH] abbrev: adjust to the new world order The default_abbrev used to be a concrete value usable as the default abbreviation length. The code that sets custom abbreviation length, in response to command line argument, often did something like: if (skip_prefix(arg, "--abbrev=", &arg)) abbrev = atoi(arg); else if (!strcmp("--abbrev", &arg)) abbrev = DEFAULT_ABBREV; /* make the value sane */ if (abbrev < 0 || 40 < abbrev) abbrev = ... some sane value ... The new world order however is that the default_abbrev is a negative value that signals find_unique_abbrev() that it needs to dynamically find out a good default value. We shouldn't coerce a negative value into a random positive value like the above sample code. Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- builtin/rev-parse.c | 5 +++-- diff.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 76cf05e2ad..17cbfabdde 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -643,8 +643,9 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) filter &= ~(DO_FLAGS|DO_NOREV); verify = 1; abbrev = DEFAULT_ABBREV; - if (arg[7] == '=') - abbrev = strtoul(arg + 8, NULL, 10); + if (!arg[7]) + continue; + abbrev = strtoul(arg + 8, NULL, 10); if (abbrev < MINIMUM_ABBREV) abbrev = MINIMUM_ABBREV; else if (40 <= abbrev) diff --git a/diff.c b/diff.c index c6da383c56..cefc13eb8e 100644 --- a/diff.c +++ b/diff.c @@ -3399,7 +3399,7 @@ void diff_setup_done(struct diff_options *options) */ read_cache(); } - if (options->abbrev <= 0 || 40 < options->abbrev) + if (40 < options->abbrev) options->abbrev = 40; /* full */ /* -- 2.10.0-612-g22341905f2