Skip to content

Commit 2f43b44

Browse files
committed
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 <peff@peff.net>
1 parent f418a5e commit 2f43b44

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

diff.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4909,6 +4909,8 @@ void repo_diff_setup(struct repository *r, struct diff_options *options)
49094909

49104910
options->color_moved = diff_color_moved_default;
49114911
options->color_moved_ws_handling = diff_color_moved_ws_default;
4912+
4913+
options->flags.allow_autoencode = -1;
49124914
}
49134915

49144916
static const char diff_status_letters[] = {
@@ -5107,6 +5109,9 @@ void diff_setup_done(struct diff_options *options)
51075109

51085110
if (options->pathspec.has_wildcard && options->max_depth_valid)
51095111
die("max-depth cannot be used with wildcard pathspecs");
5112+
5113+
if (options->flags.allow_autoencode == -1)
5114+
options->flags.allow_autoencode = !options->flags.binary;
51105115
}
51115116

51125117
int parse_long_opt(const char *opt, const char **argv,

diff.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ struct diff_flags {
194194
unsigned dirstat_by_file;
195195
unsigned allow_textconv;
196196
unsigned textconv_set_via_cmdline;
197-
unsigned allow_autoencode;
197+
int allow_autoencode;
198198
unsigned diff_from_contents;
199199
unsigned dirty_submodules;
200200
unsigned ignore_untracked_in_submodules;

0 commit comments

Comments
 (0)