Skip to content

Commit 2ce119a

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 5aec6b6 commit 2ce119a

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

diff.c

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

51945194
options->color_moved = diff_color_moved_default;
51955195
options->color_moved_ws_handling = diff_color_moved_ws_default;
5196+
5197+
options->flags.allow_autoencode = -1;
51965198
}
51975199

51985200
static const char diff_status_letters[] = {
@@ -5391,6 +5393,9 @@ void diff_setup_done(struct diff_options *options)
53915393

53925394
if (options->pathspec.has_wildcard && options->max_depth_valid)
53935395
die("max-depth cannot be used with wildcard pathspecs");
5396+
5397+
if (options->flags.allow_autoencode == -1)
5398+
options->flags.allow_autoencode = !options->flags.binary;
53945399
}
53955400

53965401
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)