git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 12/13] pull: reorganize mode conditionals

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Dec 18, 2020, 21:10 UTC
Message-ID
<20201218211026.1937168-13-felipe.contreras@gmail.com>
In-Reply-To
<20201218211026.1937168-1-felipe.contreras@gmail.com>

Now that everything is in place we can shuffle around the conditionals so it's clearer what we are trying to do.

No functional changes.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 builtin/pull.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/pull.c b/builtin/pull.c
index ef23d8a52f..ad8afabe9b 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -1118,12 +1118,12 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
 
 	can_ff = get_can_ff(&orig_head, &merge_heads.oid[0]);
 
-	if (mode == PULL_MODE_FAST_FORWARD && !can_ff)
-		die(_("The pull was not fast-forward, please either merge or rebase.\n"));
-
-	if (!opt_rebase && !can_ff) {
-		if (opt_verbosity >= 0)
+	if (!can_ff) {
+		if (!mode && opt_verbosity >= 0)
 			show_advice_pull_non_ff();
+
+		if (mode == PULL_MODE_FAST_FORWARD)
+			die(_("The pull was not fast-forward, please either merge or rebase.\n"));
 	}
 
 	if (opt_rebase >= REBASE_TRUE) {
-- 
2.30.0.rc0
Previous: Felipe ContrerasNext: Felipe Contreras
Message 12 of 14 in “pull: pull mode part 2”
  1. 00/13 pull: pull mode part 2Felipe Contreras, Dec 18, 2020
  2. 01/13 doc: pull: explain what is a fast-forwardFelipe Contreras, Dec 18, 2020
  3. 02/13 pull: improve default warningFelipe Contreras, Dec 18, 2020
  4. 04/13 pull: trivial cleanupFelipe Contreras, Dec 18, 2020
  5. 03/13 pull: cleanup autostash checkFelipe Contreras, Dec 18, 2020
  6. 05/13 pull: trivial whitespace style fixFelipe Contreras, Dec 18, 2020
  7. 06/13 pull: introduce --merge optionFelipe Contreras, Dec 18, 2020
  8. 07/13 rebase: add REBASE_DEFAULTFelipe Contreras, Dec 18, 2020
  9. 09/13 pull: show warning with --ff optionsFelipe Contreras, Dec 18, 2020
  10. 08/13 pull: move configurations fetchesFelipe Contreras, Dec 18, 2020
  11. 10/13 pull: add pull.modeFelipe Contreras, Dec 18, 2020
  12. 12/13 pull: reorganize mode conditionalsFelipe Contreras, Dec 18, 2020
  13. 13/13 pull: improve --rebase and pull.rebase interactionFelipe Contreras, Dec 18, 2020
  14. 11/13 pull: add pull.mode=fast-forwardFelipe Contreras, Dec 18, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.