From 8a022e5629ca7d730022a006ebf10732ddbab898 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 27 Feb 2018 20:31:16 -0500 Subject: [PATCH] diff: enable autoencode by default This turns on auto-encode whenever textconv is on and the --binary option has not been used. Signed-off-by: Jeff King --- diff.c | 5 +++++ diff.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/diff.c b/diff.c index 2e33760439e397..8b039225b022fb 100644 --- a/diff.c +++ b/diff.c @@ -4835,6 +4835,8 @@ void repo_diff_setup(struct repository *r, struct diff_options *options) options->color_moved = diff_color_moved_default; options->color_moved_ws_handling = diff_color_moved_ws_default; + + options->flags.allow_autoencode = -1; } static const char diff_status_letters[] = { @@ -5029,6 +5031,9 @@ void diff_setup_done(struct diff_options *options) options->filter = ~filter_bit[DIFF_STATUS_FILTER_AON]; options->filter &= ~options->filter_not; } + + if (options->flags.allow_autoencode == -1) + options->flags.allow_autoencode = !options->flags.binary; } int parse_long_opt(const char *opt, const char **argv, diff --git a/diff.h b/diff.h index 9ee7223f1da2c1..b270e8c1e64e17 100644 --- a/diff.h +++ b/diff.h @@ -186,7 +186,7 @@ struct diff_flags { unsigned dirstat_by_file; unsigned allow_textconv; unsigned textconv_set_via_cmdline; - unsigned allow_autoencode; + int allow_autoencode; unsigned diff_from_contents; unsigned dirty_submodules; unsigned ignore_untracked_in_submodules;