diff options
| author | Junio C Hamano <gitster@pobox.com> | 2017-01-17 14:49:30 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2017-01-17 14:49:30 -0800 |
| commit | 28c8a447dd4d6420fc08106efa1c288246b15845 (patch) | |
| tree | c1c40e1070da9044ca23ab7250ce1d6be868949b /diff.c | |
| parent | 12361d025fe0752342dabb06d79ff541eb081002 (diff) | |
| parent | 43d1948b7b84abc744227259dd1a3e8dfbb60358 (diff) | |
| download | git-28c8a447dd4d6420fc08106efa1c288246b15845.tar.xz | |
Merge branch 'jb/diff-no-index-no-abbrev' into maint
"git diff --no-index" did not take "--no-abbrev" option.
* jb/diff-no-index-no-abbrev:
diff: handle --no-abbrev in no-index case
Diffstat (limited to 'diff.c')
| -rw-r--r-- | diff.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -3106,7 +3106,8 @@ static const char *diff_abbrev_oid(const struct object_id *oid, int abbrev) abbrev = FALLBACK_DEFAULT_ABBREV; if (abbrev > GIT_SHA1_HEXSZ) die("BUG: oid abbreviation out of range: %d", abbrev); - hex[abbrev] = '\0'; + if (abbrev) + hex[abbrev] = '\0'; return hex; } } @@ -3364,6 +3365,7 @@ void diff_setup(struct diff_options *options) options->file = stdout; + options->abbrev = DEFAULT_ABBREV; options->line_termination = '\n'; options->break_opt = -1; options->rename_limit = -1; @@ -4024,6 +4026,8 @@ int diff_opt_parse(struct diff_options *options, offending, optarg); return argcount; } + else if (!strcmp(arg, "--no-abbrev")) + options->abbrev = 0; else if (!strcmp(arg, "--abbrev")) options->abbrev = DEFAULT_ABBREV; else if (skip_prefix(arg, "--abbrev=", &arg)) { |
