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

[PATCH 3/6] pull: trivial cleanup

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Nov 24, 2020, 13:30 UTC
Message-ID
<20201124133037.89949-4-felipe.contreras@gmail.com>
In-Reply-To
<20201124133037.89949-1-felipe.contreras@gmail.com>
There's no need to store ran_ff. Now it's obvious from the conditionals.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 builtin/pull.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/builtin/pull.c b/builtin/pull.c
index eaa268c559..121b9fb0e1 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -1023,19 +1023,18 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
 
 	if (opt_rebase) {
 		int ret = 0;
-		int ran_ff = 0;
 		if ((recurse_submodules == RECURSE_SUBMODULES_ON ||
 		     recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND) &&
 		    submodule_touches_in_range(the_repository, &rebase_fork_point, &curr_head))
 			die(_("cannot rebase with locally recorded submodule modifications"));
+
 		if (get_can_ff(&orig_head, &merge_heads.oid[0])) {
 			/* we can fast-forward this without invoking rebase */
 			opt_ff = "--ff-only";
-			ran_ff = 1;
 			ret = run_merge();
-		}
-		if (!ran_ff)
+		} else {
 			ret = run_rebase(&curr_head, merge_heads.oid, &rebase_fork_point);
+		}
 
 		if (!ret && (recurse_submodules == RECURSE_SUBMODULES_ON ||
 			     recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND))
-- 
2.29.2
Previous: Felipe ContrerasNext: Felipe Contreras
Message 4 of 7 in “pull: improve default warning”
  1. 0/6 pull: improve default warningFelipe Contreras, Nov 24, 2020
  2. 1/6 pull: refactor fast-forward checkFelipe Contreras, Nov 24, 2020
  3. 2/6 pull: cleanup autostash checkFelipe Contreras, Nov 24, 2020
  4. 3/6 pull: trivial cleanupFelipe Contreras, Nov 24, 2020
  5. 4/6 pull: move default warningFelipe Contreras, Nov 24, 2020
  6. 5/6 pull: display default warning only when non-ffFelipe Contreras, Nov 24, 2020
  7. 6/6 test: pull-options: revert unnecessary changesFelipe Contreras, Nov 24, 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.