Skip to content

making pull advice not to trigger when unneeded

Junio C Hamano git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v7 Latest5 patches 15 repliesIn review

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5pull: refactor fast-forward checkbuiltin/pull.c+15 -110 replies
2/5pull: give the advice for choosing rebase/merge much laterbuiltin/pull.c+18 -140 replies
3/5pull: get rid of unnecessary global variablebuiltin/pull.c+5 -63 replies
4/5pull: correct condition to trigger non-ff advicebuiltin/pull.c+19 -133 replies
5/5pull: display default warning only when non-ffbuiltin/pull.c t/t7601-merge-pull-config.sh+66 -73 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by.

PatchJunio C Hamano
1/5
2/5
3/5
4/5
5/5Suggestions-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH v7 0/5] making pull advice not to trigger when unneeded

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.

So with the help of can_ff bit introduced by 5/5, I _think_ this part should become like

- if (rebase_unspecified && !opt_ff && !can_ff) {
+ if (rebase_unspecified && !can_ff &&
+ (!opt_ff || !strcmp("--ff-only", opt_ff))) {

before/when we make this codepath error out. We won't hit the body of this if statement when we can fast-forward.

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) {

But these are not part of this round.

Felipe Contreras (3):
pull: refactor fast-forward check
pull: give the advice for choosing rebase/merge much later
pull: display default warning only when non-ff

Junio C Hamano (2):
pull: get rid of unnecessary global variable
pull: correct condition to trigger non-ff advice

 builtin/pull.c               | 70 ++++++++++++++++++++++--------------
 t/t7601-merge-pull-config.sh | 66 +++++++++++++++++++++++++++++++---
 2 files changed, 104 insertions(+), 32 deletions(-)
Signature · 1 line
2.30.0-rc0-186-g20447144ec