Git development
 help / color / mirror / Atom feed
From: Christian Couder <christian.couder@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Patrick Steinhardt <ps@pks.im>, Elijah Newren <newren@gmail.com>,
	Jeff King <peff@peff.net>,
	"brian m . carlson" <sandals@crustytoothpaste.net>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Justin Tobler <jltobler@gmail.com>,
	Christian Couder <christian.couder@gmail.com>
Subject: [PATCH v3 12/12] fast-import: remove useless from_stream argument
Date: Tue, 11 Aug 2026 10:33:14 +0200	[thread overview]
Message-ID: <20260811083314.2023489-13-christian.couder@gmail.com> (raw)
In-Reply-To: <20260811083314.2023489-1-christian.couder@gmail.com>

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>
---
 builtin/fast-import.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index dd873ec433..4e3c960150 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -3867,30 +3867,28 @@ static int parse_one_option(struct fast_import_state *state, const char *option)
 }
 
 static void check_unsafe_feature(struct fast_import_state *state,
-				 const char *feature,
-				 int from_stream)
+				 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)
+			     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 */
@@ -3924,7 +3922,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.530.gdb3615d990.dirty


      parent reply	other threads:[~2026-08-11  8:33 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 16:55 [PATCH 0/7] fast-import: standardize usage string and SYNOPSIS Christian Couder
2026-07-16 16:55 ` [PATCH 1/7] parse-options: introduce OPT_HIDDEN_GROUP Christian Couder
2026-07-16 21:14   ` Junio C Hamano
2026-07-16 22:14     ` .mailmap etiquette (was "Re: [PATCH 1/7] parse-options: introduce OPT_HIDDEN_GROUP") D. Ben Knoble
2026-07-16 22:31       ` Junio C Hamano
2026-08-03 17:19     ` [PATCH 1/7] parse-options: introduce OPT_HIDDEN_GROUP Christian Couder
2026-07-16 16:55 ` [PATCH 2/7] api-parse-options.adoc: document per-option flags Christian Couder
2026-07-16 16:55 ` [PATCH 3/7] api-parse-options.adoc: document hidden and OPT_*_F option macros Christian Couder
2026-07-16 16:55 ` [PATCH 4/7] fast-import: localize 'i' into the 'for' loops using it Christian Couder
2026-07-16 16:55 ` [PATCH 5/7] fast-import: introduce 'struct fast_import_state' Christian Couder
2026-07-16 16:55 ` [PATCH 6/7] fast-import: move command state globals into " Christian Couder
2026-07-16 16:55 ` [PATCH 7/7] fast-import: use struct option for usage string Christian Couder
2026-07-16 21:35   ` Junio C Hamano
2026-08-03 17:23     ` Christian Couder
2026-08-04 10:03 ` [PATCH v2 00/12] fast-import: standardize usage string and SYNOPSIS Christian Couder
2026-08-04 10:03   ` [PATCH v2 01/12] parse-options: introduce OPT_HIDDEN_GROUP Christian Couder
2026-08-04 10:03   ` [PATCH v2 02/12] api-parse-options.adoc: document per-option flags Christian Couder
2026-08-08  7:25     ` Elijah Newren
2026-08-11  8:30       ` Christian Couder
2026-08-04 10:03   ` [PATCH v2 03/12] api-parse-options.adoc: document hidden and OPT_*_F option macros Christian Couder
2026-08-04 10:03   ` [PATCH v2 04/12] fast-import: localize 'i' into the 'for' loops using it Christian Couder
2026-08-04 10:03   ` [PATCH v2 05/12] fast-import: use int for some bool flags Christian Couder
2026-08-04 10:03   ` [PATCH v2 06/12] fast-import: factor out option_*() functions Christian Couder
2026-08-04 10:03   ` [PATCH v2 07/12] fast-import: introduce 'struct fast_import_state' Christian Couder
2026-08-08  7:25     ` Elijah Newren
2026-08-11  8:30       ` Christian Couder
2026-08-04 10:03   ` [PATCH v2 08/12] fast-import: move command state globals into " Christian Couder
2026-08-04 10:03   ` [PATCH v2 09/12] fast-import: use struct option for usage string Christian Couder
2026-08-04 10:03   ` [PATCH v2 10/12] fast-import: use callbacks to parse some options Christian Couder
2026-08-04 10:03   ` [PATCH v2 11/12] fast-import: use parse_options() for command line options Christian Couder
2026-08-08  7:25     ` Elijah Newren
2026-08-11  8:32       ` Christian Couder
2026-08-04 10:03   ` [PATCH v2 12/12] fast-import: remove useless from_stream argument Christian Couder
2026-08-08  7:26   ` [PATCH v2 00/12] fast-import: standardize usage string and SYNOPSIS Elijah Newren
2026-08-11  8:33   ` [PATCH v3 " Christian Couder
2026-08-11  8:33     ` [PATCH v3 01/12] parse-options: introduce OPT_HIDDEN_GROUP Christian Couder
2026-08-11  8:33     ` [PATCH v3 02/12] api-parse-options.adoc: document per-option flags Christian Couder
2026-08-11  8:33     ` [PATCH v3 03/12] api-parse-options.adoc: document hidden and OPT_*_F option macros Christian Couder
2026-08-11  8:33     ` [PATCH v3 04/12] fast-import: localize 'i' into the 'for' loops using it Christian Couder
2026-08-11  8:33     ` [PATCH v3 05/12] fast-import: use int for some bool flags Christian Couder
2026-08-11  8:33     ` [PATCH v3 06/12] fast-import: factor out option_*() functions Christian Couder
2026-08-11  8:33     ` [PATCH v3 07/12] fast-import: introduce 'struct fast_import_state' Christian Couder
2026-08-11  8:33     ` [PATCH v3 08/12] fast-import: move command state globals into " Christian Couder
2026-08-11  8:33     ` [PATCH v3 09/12] fast-import: use struct option for usage string Christian Couder
2026-08-11  8:33     ` [PATCH v3 10/12] fast-import: use callbacks to parse some options Christian Couder
2026-08-11  8:33     ` [PATCH v3 11/12] fast-import: use parse_options() for command line options Christian Couder
2026-08-11  8:33     ` Christian Couder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260811083314.2023489-13-christian.couder@gmail.com \
    --to=christian.couder@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jltobler@gmail.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=ps@pks.im \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox