[PATCH v2 12/12] fast-import: remove useless from_stream argument
Christian Couder <[email protected]> Tue, 4 Aug 2026 12:03:55 +0200
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
Now that a previous commit has removed a call to parse_one_feature() from parse_argv(), the former is always called with its `from_stream` argument set to 1. Let's take advantage of that to simplify and cleanup the code a bit. Signed-off-by: Christian Couder <[email protected]> --- builtin/fast-import.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 0df7a31014..9d827f2224 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -3840,27 +3840,27 @@ static int parse_one_option(struct fast_import_state *state, const char *option) return 1; } -static void check_unsafe_feature(struct fast_import_state *state, const char *feature, int from_stream) +static void check_unsafe_feature(struct fast_import_state *state, const char *feature) { - if (from_stream && !state->allow_unsafe_features) + if (!state->allow_unsafe_features) die(_("feature '%s' forbidden in input without --allow-unsafe-features"), feature); } -static int parse_one_feature(struct fast_import_state *state, const char *feature, int from_stream) +static int parse_one_feature(struct fast_import_state *state, const char *feature) { const char *arg; if (skip_prefix(feature, "date-format=", &arg)) { option_date_format(arg); } else if (skip_prefix(feature, "import-marks=", &arg)) { - check_unsafe_feature(state, "import-marks", from_stream); - option_import_marks(state, arg, from_stream, 0); + check_unsafe_feature(state, "import-marks"); + option_import_marks(state, arg, 1, 0); } else if (skip_prefix(feature, "import-marks-if-exists=", &arg)) { - check_unsafe_feature(state, "import-marks-if-exists", from_stream); - option_import_marks(state, arg, from_stream, 1); + check_unsafe_feature(state, "import-marks-if-exists"); + option_import_marks(state, arg, 1, 1); } else if (skip_prefix(feature, "export-marks=", &arg)) { - check_unsafe_feature(state, feature, from_stream); + check_unsafe_feature(state, feature); option_export_marks(state, arg); } else if (!strcmp(feature, "alias")) { ; /* Don't die - this feature is supported */ @@ -3894,7 +3894,7 @@ static void parse_feature(struct fast_import_state *state, const char *feature) if (state->seen_data_command) die(_("got feature command '%s' after data command"), feature); - if (parse_one_feature(state, feature, 1)) + if (parse_one_feature(state, feature)) return; die(_("this version of fast-import does not support feature %s."), feature); -- 2.55.0.492.g44bba30fd7.dirty