diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2019-03-05 19:30:25 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-03-07 08:02:22 +0900 |
commit | b680ee1495fb55e2a4236456971b3d427989eb55 (patch) | |
tree | 77045e7f7931af3536e573299e76759111a7a350 /diff.c | |
parent | diff-parseopt: convert --textconv (diff) | |
download | tgif-b680ee1495fb55e2a4236456971b3d427989eb55.tar.xz |
diff-parseopt: convert --ignore-submodules
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.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -5013,6 +5013,19 @@ static int diff_opt_follow(const struct option *opt, return 0; } +static int diff_opt_ignore_submodules(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_NEG(unset); + if (!arg) + arg = "all"; + options->flags.override_submodule_config = 1; + handle_ignore_submodules_arg(options, arg); + return 0; +} + static enum parse_opt_result diff_opt_output(struct parse_opt_ctx_t *ctx, const struct option *opt, const char *arg, int unset) @@ -5321,6 +5334,10 @@ static void prep_parse_options(struct diff_options *options) OPT_CALLBACK_F(0, "textconv", options, NULL, N_("run external text conversion filters when comparing binary files"), PARSE_OPT_NOARG, diff_opt_textconv), + OPT_CALLBACK_F(0, "ignore-submodules", options, N_("<when>"), + N_("ignore changes to submodules in the diff generation"), + PARSE_OPT_NONEG | PARSE_OPT_OPTARG, + diff_opt_ignore_submodules), { OPTION_CALLBACK, 0, "output", options, N_("<file>"), N_("Output to a specific file"), PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, @@ -5370,9 +5387,6 @@ int diff_opt_parse(struct diff_options *options, if (cm & COLOR_MOVED_WS_ERROR) return -1; options->color_moved_ws_handling = cm; - } 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")) return parse_submodule_opt(options, arg); else if (skip_prefix(arg, "--ws-error-highlight=", &arg)) |