Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-03-05 15:30:24 +0300
committerJunio C Hamano <gitster@pobox.com>2019-03-07 02:02:22 +0300
commit8ab76977ad22cc9236f3b541f4933c0fcdc234d5 (patch)
tree12557756395edb4bf7b690f2fa42f0df80c89479 /diff.c
parent0cda1003b785f0ac36f8c2975f70fdb6ab450987 (diff)
diff-parseopt: convert --textconv
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/diff.c b/diff.c
index b460fa010b..a27bca527d 100644
--- a/diff.c
+++ b/diff.c
@@ -5062,6 +5062,21 @@ static int diff_opt_relative(const struct option *opt,
return 0;
}
+static int diff_opt_textconv(const struct option *opt,
+ const char *arg, int unset)
+{
+ struct diff_options *options = opt->value;
+
+ BUG_ON_OPT_ARG(arg);
+ if (unset) {
+ options->flags.allow_textconv = 0;
+ } else {
+ options->flags.allow_textconv = 1;
+ options->flags.textconv_set_via_cmdline = 1;
+ }
+ return 0;
+}
+
static int diff_opt_unified(const struct option *opt,
const char *arg, int unset)
{
@@ -5303,6 +5318,9 @@ static void prep_parse_options(struct diff_options *options)
N_("disable all output of the program")),
OPT_BOOL(0, "ext-diff", &options->flags.allow_external,
N_("allow an external diff helper to be executed")),
+ OPT_CALLBACK_F(0, "textconv", options, NULL,
+ N_("run external text conversion filters when comparing binary files"),
+ PARSE_OPT_NOARG, diff_opt_textconv),
{ OPTION_CALLBACK, 0, "output", options, N_("<file>"),
N_("Output to a specific file"),
PARSE_OPT_NONEG, NULL, 0, diff_opt_output },
@@ -5352,12 +5370,7 @@ int diff_opt_parse(struct diff_options *options,
if (cm & COLOR_MOVED_WS_ERROR)
return -1;
options->color_moved_ws_handling = cm;
- } else if (!strcmp(arg, "--textconv")) {
- options->flags.allow_textconv = 1;
- options->flags.textconv_set_via_cmdline = 1;
- } else if (!strcmp(arg, "--no-textconv"))
- options->flags.allow_textconv = 0;
- else if (skip_to_optional_arg_default(arg, "--ignore-submodules", &arg, "all")) {
+ } else if (skip_to_optional_arg_default(arg, "--ignore-submodules", &arg, "all")) {
options->flags.override_submodule_config = 1;
handle_ignore_submodules_arg(options, arg);
} else if (skip_to_optional_arg_default(arg, "--submodule", &arg, "log"))