diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-04-22 13:42:47 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-22 13:42:47 -0700 |
commit | dfdce31ce6c9c4d7266031ea70f982e7f22bb525 (patch) | |
tree | 451a384d7d70ceaf0cf70f95f900d859de56826f | |
parent | Merge branch 'dl/wrapper-fix-indentation' (diff) | |
parent | pull: avoid running both merge and rebase (diff) | |
download | tgif-dfdce31ce6c9c4d7266031ea70f982e7f22bb525.tar.xz |
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
-rw-r--r-- | builtin/pull.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/pull.c b/builtin/pull.c index 880eb29852..ef0baa0fe2 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -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)) |