diff mbox series

[v4,05/19] pull: trivial cleanup

Message ID 20201208002648.1370414-6-felipe.contreras@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v4,01/19] doc: pull: explain what is a fast-forward | expand

Commit Message

Felipe Contreras Dec. 8, 2020, 12:26 a.m. UTC
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 mbox series

Patch

diff --git a/builtin/pull.c b/builtin/pull.c
index d44ca2ffde..6aeca4aeae 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -1041,7 +1041,6 @@  int cmd_pull(int argc, const char **argv, const char *prefix)
 
 	if (opt_rebase) {
 		int ret = 0;
-		int ran_ff = 0;
 
 		struct object_id newbase;
 		struct object_id upstream;
@@ -1052,14 +1051,14 @@  int cmd_pull(int argc, const char **argv, const char *prefix)
 		     recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND) &&
 		    submodule_touches_in_range(the_repository, &upstream, &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(&newbase, &upstream);
+		}
 
 		if (!ret && (recurse_submodules == RECURSE_SUBMODULES_ON ||
 			     recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND))