Re: git-rebase produces incorrect output
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 30, 2019, 17:58 UTC
- Message-ID
- <xmqqa78d2qmk.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <CABPp-BGiu2nVMQY_t-rnFR5GQUz_ipyEE8oDocKeO+h+t4Mn4A@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 6 quoted lines
> Sadly, I tried to force this with git rebase, but -C5 only affected > the apply side and there's no option to pass to rebase to pass through > -U5 to the diff logic. Also, although there is a diff.context config > option, git-am ignores it (Note that git_am_config() does not directly > check that value and it calls git_default_config(), not > git_diff_ui_config() or even git_diff_basic_config()).
Not essential but puzzled. The context applies to the generation side, not acceptance side, no? IOW, I suspect that you are talking about "git format-patch" that sits on the upstream side of the pipe that feeds "git am".
Show 6 quoted lines
> So, to summarize here: > * you have a case where the default 3 lines of context mess stuff > up; but rebase --merge works great > * am doesn't have a -U option, and ignores the diff.context setting, > making it impossible to force the am backend to work on your case > and also:
I do not think it is super hard to teach "git rebase" to pass backend specific options so that "git rebase--am" can be told to work with wider context (which will reduce the risk of ambiguous patch like this example, trading the increased risk of unnecessary conflicts; it is a good trade-off most of the time for added safety, as nobody wants a system that produces a wrong result silently and quickly).
Having said that,
> * rebase doesn't have an option to use the merge/interactive backend > by default (nor an --am option to override it)
I think addition of rebase.backend would be a good first step for eventually flipping the default, which by the way I have no trouble with.
> Maybe we should just switch the default, for everyone? (And provide > an --am option to override it and a config setting to get the old > default?)
Yes, that would be a sensible second step. I actually think a longer term goal is to deprecate the am backend. It was invented first and then kept to be the default backend for a long time because the merge based backend historically has been noticeably slow (it was expected to be---it was essentially a shell script that run cherry-pick repeatedly in a loop). In some future, it would outlive its usefulness, and that I think that that future is just around the corner.