1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-20 08:46:07 +02:00

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
This commit is contained in:
Junio C Hamano 2020-04-22 13:42:47 -07:00
commit dfdce31ce6

View File

@ -1010,6 +1010,7 @@ 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))
@ -1026,10 +1027,12 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
if (is_descendant_of(merge_head, list)) {
/* we can fast-forward this without invoking rebase */
opt_ff = "--ff-only";
ran_ff = 1;
ret = run_merge();
}
}
ret = run_rebase(&curr_head, merge_heads.oid, &rebase_fork_point);
if (!ran_ff)
ret = run_rebase(&curr_head, merge_heads.oid, &rebase_fork_point);
if (!ret && (recurse_submodules == RECURSE_SUBMODULES_ON ||
recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND))