archive mirror
 help / color / mirror / Atom feed
From: Denton Liu <>
To: Git Mailing List <>
Cc: Alex Henrie <>
Subject: [PATCH] pull: do not warn when opt_ff is explicitly specified
Date: Wed, 23 Sep 2020 02:56:31 -0700	[thread overview]
Message-ID: <> (raw)

In d18c950a69 (pull: warn if the user didn't say whether to rebase or to
merge, 2020-03-09), `git pull` was taught to warn users if they
have `pull.rebase` unset or `pull.ff != "only"`. However, this warning
is a little too eager about happening.

If the warning is silenced by specifying `pull.ff = "only"`, as
instructed, the warning will arise again if the user runs
something like `git pull --no-ff`. However, the warning should not
happen as the user clearly knows what they're doing.

Don't display the warning if opt_ff is explicitly set by a command-line
option given by a user.

Signed-off-by: Denton Liu <>
 builtin/pull.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/builtin/pull.c b/builtin/pull.c
index 015f6ded0b..307b4b5d21 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -83,6 +83,7 @@ static char *opt_commit;
 static char *opt_edit;
 static char *cleanup_arg;
 static char *opt_ff;
+static int opt_ff_explicit;
 static char *opt_verify_signatures;
 static int opt_autostash = -1;
 static int config_autostash;
@@ -344,7 +345,7 @@ static enum rebase_type config_get_rebase(void)
 	if (!git_config_get_value("pull.rebase", &value))
 		return parse_config_rebase("pull.rebase", value, 1);
-	if (opt_verbosity >= 0 &&
+	if (!opt_ff_explicit && opt_verbosity >= 0 &&
 	    (!opt_ff || strcmp(opt_ff, "--ff-only"))) {
 		warning(_("Pulling without specifying how to reconcile divergent branches is\n"
 			"discouraged. You can squelch this message by running one of the following\n"
@@ -933,6 +934,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
 	if (!opt_ff)
 		opt_ff = xstrdup_or_null(config_get_ff());
+	else
+		opt_ff_explicit = 1;
 	if (opt_rebase < 0)
 		opt_rebase = config_get_rebase();

             reply	other threads:[~2020-09-23  9:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23  9:56 Denton Liu [this message]
2020-09-23 16:40 ` Junio C Hamano
2020-09-23 18:25 ` Alex Henrie
2020-09-23 18:33   ` Alex Henrie

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:

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

  git send-email \ \ \ \ \
    --subject='Re: [PATCH] pull: do not warn when opt_ff is explicitly specified' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).