Skip to content

Commit 96f17c8

Browse files
committed
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>
1 parent 95919e8 commit 96f17c8

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

builtin/fast-import.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3867,30 +3867,28 @@ static int parse_one_option(struct fast_import_state *state, const char *option)
38673867
}
38683868

38693869
static void check_unsafe_feature(struct fast_import_state *state,
3870-
const char *feature,
3871-
int from_stream)
3870+
const char *feature)
38723871
{
3873-
if (from_stream && !state->allow_unsafe_features)
3872+
if (!state->allow_unsafe_features)
38743873
die(_("feature '%s' forbidden in input without --allow-unsafe-features"),
38753874
feature);
38763875
}
38773876

38783877
static int parse_one_feature(struct fast_import_state *state,
3879-
const char *feature,
3880-
int from_stream)
3878+
const char *feature)
38813879
{
38823880
const char *arg;
38833881

38843882
if (skip_prefix(feature, "date-format=", &arg)) {
38853883
option_date_format(arg);
38863884
} else if (skip_prefix(feature, "import-marks=", &arg)) {
3887-
check_unsafe_feature(state, "import-marks", from_stream);
3888-
option_import_marks(state, arg, from_stream, 0);
3885+
check_unsafe_feature(state, "import-marks");
3886+
option_import_marks(state, arg, 1, 0);
38893887
} else if (skip_prefix(feature, "import-marks-if-exists=", &arg)) {
3890-
check_unsafe_feature(state, "import-marks-if-exists", from_stream);
3891-
option_import_marks(state, arg, from_stream, 1);
3888+
check_unsafe_feature(state, "import-marks-if-exists");
3889+
option_import_marks(state, arg, 1, 1);
38923890
} else if (skip_prefix(feature, "export-marks=", &arg)) {
3893-
check_unsafe_feature(state, feature, from_stream);
3891+
check_unsafe_feature(state, feature);
38943892
option_export_marks(state, arg);
38953893
} else if (!strcmp(feature, "alias")) {
38963894
; /* Don't die - this feature is supported */
@@ -3924,7 +3922,7 @@ static void parse_feature(struct fast_import_state *state, const char *feature)
39243922
if (state->seen_data_command)
39253923
die(_("got feature command '%s' after data command"), feature);
39263924

3927-
if (parse_one_feature(state, feature, 1))
3925+
if (parse_one_feature(state, feature))
39283926
return;
39293927

39303928
die(_("this version of fast-import does not support feature %s."), feature);

0 commit comments

Comments
 (0)