diff options
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -3102,7 +3102,9 @@ static const char *diff_abbrev_oid(const struct object_id *oid, int abbrev) return find_unique_abbrev(oid->hash, abbrev); else { char *hex = oid_to_hex(oid); - if (abbrev < 0 || abbrev > GIT_SHA1_HEXSZ) + if (abbrev < 0) + abbrev = FALLBACK_DEFAULT_ABBREV; + if (abbrev > GIT_SHA1_HEXSZ) die("BUG: oid abbreviation out of range: %d", abbrev); hex[abbrev] = '\0'; return hex; @@ -3481,7 +3483,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 */ /* |