Skip to content

Commit dfdce31

Browse files
committed
Merge branch 'en/pull-do-not-rebase-after-fast-forwarding'
"git pull --rebase" tried to run a rebase even after noticing that the pull results in a fast-forward and no rebase is needed nor sensible, for the past few years due to a mistake nobody noticed. * en/pull-do-not-rebase-after-fast-forwarding: pull: avoid running both merge and rebase
2 parents b660a76 + fbae70d commit dfdce31

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

builtin/pull.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
10101010

10111011
if (opt_rebase) {
10121012
int ret = 0;
1013+
int ran_ff = 0;
10131014
if ((recurse_submodules == RECURSE_SUBMODULES_ON ||
10141015
recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND) &&
10151016
submodule_touches_in_range(the_repository, &rebase_fork_point, &curr_head))
@@ -1026,10 +1027,12 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
10261027
if (is_descendant_of(merge_head, list)) {
10271028
/* we can fast-forward this without invoking rebase */
10281029
opt_ff = "--ff-only";
1030+
ran_ff = 1;
10291031
ret = run_merge();
10301032
}
10311033
}
1032-
ret = run_rebase(&curr_head, merge_heads.oid, &rebase_fork_point);
1034+
if (!ran_ff)
1035+
ret = run_rebase(&curr_head, merge_heads.oid, &rebase_fork_point);
10331036

10341037
if (!ret && (recurse_submodules == RECURSE_SUBMODULES_ON ||
10351038
recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND))

0 commit comments

Comments
 (0)