Skip to content

Commit

Permalink
diff: enable autoencode by default
Browse files Browse the repository at this point in the history
This turns on auto-encode whenever textconv is on and the
--binary option has not been used.

Signed-off-by: Jeff King <[email protected]>
  • Loading branch information
peff committed Dec 10, 2024
1 parent 811932d commit 8a022e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion diff.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8a022e5

Please sign in to comment.