From: Junio C Hamano <gitster@pobox.com>
To: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, "Alex Henrie" <alexhenrie24@gmail.com>,
"Son Luong Ngoc" <sluongng@gmail.com>,
"Matthias Baumgarten" <matthias.baumgarten@aixigo.com>,
"Eric Sunshine" <sunshine@sunshineco.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Elijah Newren" <newren@gmail.com>
Subject: Re: [PATCH 5/9] pull: ensure --rebase overrides ability to ff
Date: Tue, 20 Jul 2021 16:35:00 -0700 [thread overview]
Message-ID: <xmqqwnpkftjv.fsf@gitster.g> (raw)
In-Reply-To: <3d9ff69198e5a604b124bf861df4d6ecf6eb661e.1626536508.git.gitgitgadget@gmail.com> (Elijah Newren via GitGitGadget's message of "Sat, 17 Jul 2021 15:41:43 +0000")
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Elijah Newren <newren@gmail.com>
>
> Now that the handling of fast-forward-only in combination with rebases
> has been moved before the merge-vs-rebase logic, we have an unnecessary
> special fast-forward case left within the rebase logic.
It is correct to say that we could call run_rebase() and it will do
the right thing, even when can_ff is true, in this codepath.
But I am not sure if you want to do this as a part of this series.
The code in question comes from 33b842a1 (pull: fast-forward "pull
--rebase=true", 2016-06-29). It was meant as a mere optimization
to avoid calling run_rebase() when we know we have nothing to replay
on top of their head after we fast-forward, and doing a pure
fast-forward is easier by calling run_merge().
In other words, the code this patch touches should not have anything
to do with the rebase-vs-fast-forward logic.
Now, if a benchmarking tells us that there is no difference between
calling an empty run_rebase() and run_merge(), I'd be perfectly fine
with this change, with the justification that we are "discarding an
earlier optimization that has become irrelevant". But that would be
totally outside the theme of this topic, I would think.
Thanks.
> @@ -1070,13 +1070,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
> submodule_touches_in_range(the_repository, &upstream, &curr_head))
> die(_("cannot rebase with locally recorded submodule modifications"));
>
> - if (can_ff) {
> - /* we can fast-forward this without invoking rebase */
> - opt_ff = "--ff-only";
> - ret = run_merge();
> - } else {
> - ret = run_rebase(&newbase, &upstream);
> - }
> + ret = run_rebase(&newbase, &upstream);
>
> if (!ret && (recurse_submodules == RECURSE_SUBMODULES_ON ||
> recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND))
> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
> index e2c0c510222..4b50488141f 100755
> --- a/t/t5520-pull.sh
> +++ b/t/t5520-pull.sh
> @@ -295,7 +295,7 @@ test_expect_success '--rebase (merge) fast forward' '
> # The above only validates the result. Did we actually bypass rebase?
> git reflog -1 >reflog.actual &&
> sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy &&
> - echo "OBJID HEAD@{0}: pull --rebase . ff: Fast-forward" >reflog.expected &&
> + echo "OBJID HEAD@{0}: pull --rebase . ff (finish): returning to refs/heads/to-rebase" >reflog.expected &&
> test_cmp reflog.expected reflog.fuzzy
> '
>
> @@ -307,8 +307,8 @@ test_expect_success '--rebase (am) fast forward' '
>
> # The above only validates the result. Did we actually bypass rebase?
> git reflog -1 >reflog.actual &&
> - sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy &&
> - echo "OBJID HEAD@{0}: pull --rebase . ff: Fast-forward" >reflog.expected &&
> + sed -e "s/^[0-9a-f][0-9a-f]*/OBJID/" -e "s/[0-9a-f][0-9a-f]*$/OBJID/" reflog.actual >reflog.fuzzy &&
> + echo "OBJID HEAD@{0}: rebase finished: refs/heads/to-rebase onto OBJID" >reflog.expected &&
> test_cmp reflog.expected reflog.fuzzy
> '
next prev parent reply other threads:[~2021-07-20 23:39 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-17 15:41 [PATCH 0/9] Handle pull option precedence Elijah Newren via GitGitGadget
2021-07-17 15:41 ` [PATCH 1/9] t7601: add relative precedence tests for merge and rebase flags/options Elijah Newren via GitGitGadget
2021-07-17 18:03 ` Felipe Contreras
2021-07-19 18:23 ` Junio C Hamano
2021-07-20 17:10 ` Elijah Newren
2021-07-20 18:22 ` Junio C Hamano
2021-07-20 20:29 ` Felipe Contreras
2021-07-17 15:41 ` [PATCH 2/9] t7601: add tests of interactions with multiple merge heads and config Elijah Newren via GitGitGadget
2021-07-17 18:04 ` Felipe Contreras
2021-07-20 23:11 ` Junio C Hamano
2021-07-21 0:45 ` Elijah Newren
2021-07-17 15:41 ` [PATCH 3/9] pull: abort if --ff-only is given and fast-forwarding is impossible Alex Henrie via GitGitGadget
2021-07-17 18:14 ` Felipe Contreras
2021-07-17 15:41 ` [PATCH 4/9] pull: since --ff-only overrides, handle it first Elijah Newren via GitGitGadget
2021-07-17 18:22 ` Felipe Contreras
2021-07-17 15:41 ` [PATCH 5/9] pull: ensure --rebase overrides ability to ff Elijah Newren via GitGitGadget
2021-07-17 18:25 ` Felipe Contreras
2021-07-20 23:35 ` Junio C Hamano [this message]
2021-07-21 0:14 ` Elijah Newren
2021-07-17 15:41 ` [PATCH 6/9] pull: make --rebase and --no-rebase override pull.ff=only Elijah Newren via GitGitGadget
2021-07-17 18:28 ` Felipe Contreras
2021-07-20 23:53 ` Junio C Hamano
2021-07-21 0:09 ` Felipe Contreras
2021-07-17 15:41 ` [PATCH 7/9] pull: abort by default when fast-forwarding is not possible Elijah Newren via GitGitGadget
2021-07-17 18:31 ` Felipe Contreras
2021-07-17 15:41 ` [PATCH 8/9] pull: update docs & code for option compatibility with rebasing Elijah Newren via GitGitGadget
2021-07-21 0:17 ` Junio C Hamano
2021-07-21 0:44 ` Elijah Newren
2021-07-21 1:25 ` Junio C Hamano
2021-07-17 15:41 ` [PATCH 9/9] pull: fix handling of multiple heads Elijah Newren via GitGitGadget
2021-07-17 18:39 ` [PATCH 0/9] Handle pull option precedence Felipe Contreras
2021-07-21 1:42 ` [PATCH v2 0/8] " Elijah Newren via GitGitGadget
2021-07-21 1:42 ` [PATCH v2 1/8] t7601: test interaction of merge/rebase/fast-forward flags and options Elijah Newren via GitGitGadget
2021-07-21 12:24 ` Felipe Contreras
2021-07-21 1:42 ` [PATCH v2 2/8] t7601: add tests of interactions with multiple merge heads and config Elijah Newren via GitGitGadget
2021-07-21 1:42 ` [PATCH v2 3/8] pull: abort if --ff-only is given and fast-forwarding is impossible Alex Henrie via GitGitGadget
2021-07-21 12:25 ` Felipe Contreras
2021-07-21 1:42 ` [PATCH v2 4/8] pull: since --ff-only overrides, handle it first Elijah Newren via GitGitGadget
2021-07-21 19:18 ` Matthias Baumgarten
2021-07-21 21:18 ` Felipe Contreras
2021-07-21 20:18 ` Junio C Hamano
2021-07-22 3:42 ` Elijah Newren
2021-07-21 1:42 ` [PATCH v2 5/8] pull: make --rebase and --no-rebase override pull.ff=only Elijah Newren via GitGitGadget
2021-07-21 12:26 ` Felipe Contreras
2021-07-21 1:42 ` [PATCH v2 6/8] pull: abort by default when fast-forwarding is not possible Elijah Newren via GitGitGadget
2021-07-21 12:27 ` Felipe Contreras
2021-07-21 1:42 ` [PATCH v2 7/8] pull: update docs & code for option compatibility with rebasing Elijah Newren via GitGitGadget
2021-07-21 1:42 ` [PATCH v2 8/8] pull: fix handling of multiple heads Elijah Newren via GitGitGadget
2021-07-21 12:15 ` [PATCH v2 0/8] Handle pull option precedence Felipe Contreras
2021-07-22 5:04 ` [PATCH v3 " Elijah Newren via GitGitGadget
2021-07-22 5:04 ` [PATCH v3 1/8] t7601: test interaction of merge/rebase/fast-forward flags and options Elijah Newren via GitGitGadget
2021-07-22 5:04 ` [PATCH v3 2/8] t7601: add tests of interactions with multiple merge heads and config Elijah Newren via GitGitGadget
2021-07-22 5:04 ` [PATCH v3 3/8] pull: abort if --ff-only is given and fast-forwarding is impossible Alex Henrie via GitGitGadget
2021-07-22 5:04 ` [PATCH v3 4/8] pull: since --ff-only overrides, handle it first Elijah Newren via GitGitGadget
2021-07-22 5:04 ` [PATCH v3 5/8] pull: make --rebase and --no-rebase override pull.ff=only Elijah Newren via GitGitGadget
2021-07-22 5:04 ` [PATCH v3 6/8] pull: abort by default when fast-forwarding is not possible Elijah Newren via GitGitGadget
2021-07-22 5:04 ` [PATCH v3 7/8] pull: update docs & code for option compatibility with rebasing Elijah Newren via GitGitGadget
2021-07-22 5:04 ` [PATCH v3 8/8] pull: fix handling of multiple heads Elijah Newren via GitGitGadget
2021-07-22 7:09 ` [PATCH v3 0/8] Handle pull option precedence Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqwnpkftjv.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=alexhenrie24@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=matthias.baumgarten@aixigo.com \
--cc=newren@gmail.com \
--cc=sluongng@gmail.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).