From: Felipe Contreras <felipe.contreras@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: RE: [PATCH v7 0/5] making pull advice not to trigger when unneeded
Date: Tue, 15 Dec 2020 00:30:41 -0600 [thread overview]
Message-ID: <5fd85811c3a6_d7c48208aa@natae.notmuch> (raw)
In-Reply-To: <20201214202647.3340193-1-gitster@pobox.com>
Junio C Hamano wrote:
> Just to show what was pushed out on 'seen' while I was cutting the
> preview release...
>
> This is based on Felipe's v6 (which was mislabled as v5 but sent on
> a different day from the true v5), with two clean-up commits
> inserted between Felipe's second step (now 2/5) and the third step
> (now 5/5, with necessary adjustments).
>
> Even with the "correct condition" clean-up, I am not quite happy
> with the clarity of the logic around there.
>
> I think !opt_ff does not exactly belong to the condition, if we
> consider that the eventual endgame should be to stop non-ff
> operation without merge or rebase by default with an error, and that
> should happen in this block. The error message there should say
> "unable to fast-forward; must merge or rebase", which should equally
> apply to those who gave "--ff-only" explicitly, even though they may
> not need the advice message.
Agreed. Additionally it doesn't make sense that --ff skips the warning
entirely, even though the user has not specified a merge or a rebase (as
you yourself noted in a review of the test cases).
> To avoid the ugly-looking "strcmp()" in the above, we may need to
> adjust "--ff" (fast-forward without creating an extra merge commit)
> and "--no-ff" (create an extra merge commit when the history could
> be fast-forwarded) to imply "merge", though. It would automatically
> make rebase_unspecified would become false. With such a tweak, we
> can then simplify it further to
>
> - if (rebase_unspecified && !can_ff &&
> - (!opt_ff || !strcmp("--ff-only", opt_ff))) {
> + if (rebase_unspecified && !can_ff) {
Currently this is a rebase:
git pull --rebase --ff
With your proposed change it would be an implied merge. I think it makes
sense, but it's still a change in behavior.
This patch should do the trick:
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -973,6 +973,11 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
if (opt_rebase < 0)
opt_rebase = config_get_rebase(&rebase_unspecified);
+ if (opt_ff && (!strcmp(opt_ff, "--ff") || !strcmp(opt_ff, "--no-ff"))) {
+ opt_rebase = 0;
+ rebase_unspecified = 0;
+ }
+
if (read_cache_unmerged())
die_resolve_conflict("pull");
Or do you mean --ff doesn't override --rebase? Therefore it's more of an
internal conceptual change.
--
Felipe Contreras
next prev parent reply other threads:[~2020-12-15 6:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-14 20:26 [PATCH v7 0/5] making pull advice not to trigger when unneeded Junio C Hamano
2020-12-14 20:26 ` [PATCH v7 1/5] pull: refactor fast-forward check Junio C Hamano
2020-12-14 20:26 ` [PATCH v7 2/5] pull: give the advice for choosing rebase/merge much later Junio C Hamano
2020-12-14 20:26 ` [PATCH v7 3/5] pull: get rid of unnecessary global variable Junio C Hamano
2020-12-14 20:59 ` Felipe Contreras
2020-12-14 23:16 ` Junio C Hamano
2020-12-15 2:55 ` Felipe Contreras
2020-12-14 20:26 ` [PATCH v7 4/5] pull: correct condition to trigger non-ff advice Junio C Hamano
2020-12-14 21:17 ` Felipe Contreras
2020-12-14 23:19 ` Junio C Hamano
2020-12-15 6:35 ` Felipe Contreras
2020-12-14 20:26 ` [PATCH v7 5/5] pull: display default warning only when non-ff Junio C Hamano
2020-12-14 21:24 ` Felipe Contreras
2020-12-14 23:20 ` Junio C Hamano
2020-12-15 2:57 ` Felipe Contreras
2020-12-15 6:30 ` Felipe Contreras [this message]
2020-12-15 10:58 ` [PATCH v7 0/5] making pull advice not to trigger when unneeded Junio C Hamano
2020-12-15 12:22 ` Felipe Contreras
2020-12-18 20:46 ` Felipe Contreras
2020-12-23 10:04 ` Junio C Hamano
2020-12-23 14:10 ` 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=5fd85811c3a6_d7c48208aa@natae.notmuch \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.