[PATCH 2/5] pull: convert OPT_PASSTHRU for fast-forward options to OPT_CALLBACK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Elijah Newren <newren@xxxxxxxxx>

This results in no functional changes, but allows us to add logic to
the callback in a subsequent commit.

Signed-off-by: Elijah Newren <newren@xxxxxxxxx>
---
 builtin/pull.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/builtin/pull.c b/builtin/pull.c
index 61c68e4143f..d99719403d0 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -112,6 +112,16 @@ static int parse_opt_rebase(const struct option *opt, const char *arg, int unset
 	return *value == REBASE_INVALID ? -1 : 0;
 }
 
+static int parse_opt_ff(const struct option *opt, const char *arg, int unset)
+{
+	if (unset)
+		opt_ff = "--no-ff";
+	else
+		opt_ff = xstrfmt("--%s", opt->long_name);
+
+	return 0;
+}
+
 static struct option pull_options[] = {
 	/* Shared options */
 	OPT__VERBOSITY(&opt_verbosity),
@@ -154,12 +164,14 @@ static struct option pull_options[] = {
 		N_("edit message before committing"),
 		PARSE_OPT_NOARG),
 	OPT_CLEANUP(&cleanup_arg),
-	OPT_PASSTHRU(0, "ff", &opt_ff, NULL,
-		N_("allow fast-forward"),
-		PARSE_OPT_NOARG),
-	OPT_PASSTHRU(0, "ff-only", &opt_ff, NULL,
-		N_("abort if fast-forward is not possible"),
-		PARSE_OPT_NOARG | PARSE_OPT_NONEG),
+	OPT_CALLBACK_F(0, "ff", &opt_ff, NULL,
+			N_("allow fast-forward"),
+			PARSE_OPT_NOARG,
+			parse_opt_ff),
+	OPT_CALLBACK_F(0, "ff-only", &opt_ff, NULL,
+			N_("abort if fast-forward is not possible"),
+			PARSE_OPT_NOARG | PARSE_OPT_NONEG,
+			parse_opt_ff),
 	OPT_PASSTHRU(0, "verify-signatures", &opt_verify_signatures, NULL,
 		N_("verify that the named commit has a valid GPG signature"),
 		PARSE_OPT_NOARG),
-- 
gitgitgadget




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux