fast-import: remove useless from_stream argument

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 <christian.couder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Christian Couder
2026-08-04 12:03:55 +02:00
committed by Junio C Hamano
parent 79e3430248
commit bff5741baf

View File

@@ -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);