git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Confusing (maybe wrong?) conflict output with ort

From
AHAlex Xu (Hello71) <alex_y_xu@yahoo.ca>
Date
Dec 3, 2021, 00:40 UTC
Message-ID
<1638491699.9sjos0rkh4.none@localhost>
In-Reply-To
<CABPp-BEyy97x-9od+9E9DxCDHHq-m8hyZJWqxFutkRy3G7Hu9g@mail.gmail.com>
Excerpts from Elijah Newren's message of December 2, 2021 6:58 pm:
Show 37 quoted lines
> Hi,
> 
> On Thu, Dec 2, 2021 at 11:08 AM Alex Xu (Hello71) <alex_y_xu@yahoo.ca> wrote:
>>
>> Hi all,
>>
>> After upgrading to git 2.34.1, I tried to rebase [0] onto [1], but
>> encountered "strange" conflict results.
>>
>> git rebase -s recursive main produces [[RECURSIVE]]. It is roughly what
>> I expected to be output. If I take all the changes from the upper
>> section of the conflict, my changes will be effectively undone. If I
>> take all the changes from the lower section, then the upstream changes
>> will be undone.
> 
> In general, this does not work.  The only time it can work is if every
> region of the code considered by the three-way content merge ended up
> with conflicts.  (If any of those regions had automatically resolvable
> changes, then after taking just the upper section(s) or just the lower
> section(s) of each conflict would still result in a file that is a
> mixture of changes from both sides due to the automatically resolvable
> chunks that the merge already handled.)
> 
>> On the other hand, running git rebase -s ort main produces [[ORT]]. I am
>> unsure if it is wrong, strictly speaking, but it is certainly unexpected
>> and difficult for me to resolve. Selecting the upper section of the
>> conflict does erase my changes, as before, but selecting the lower
>> section results in syntactically incorrect code (foreach is ended by
>> endif). The diff3 output makes even less sense to me.
> 
> The output from using ort is identical to that obtained by
> 
>    git rebase -s recursive -Xdiff-algorithm=histogram ...
> 
> on your testcase; i.e. this is due to a difference between the
> histogram and myers diff algorithms.
> (recursive defaults to using myers diff; ort uses histogram diff.)
[ ... ]
> Does that help explain things?

Hm, I did try both default and patience and it didn't make a difference. git rebase -s recursive -Xdiff-algorithm=histogram master does produce the same result as ort though. I probably should have tried that first. Thanks for the explanation though, that's very helpful!

Cheers, Alex.

Previous: Elijah Newren
Message 3 of 3 in “Confusing (maybe wrong?) conflict output with ort”
  1. Alex Xu (Hello71)Dec 2, 2021
  2. Elijah NewrenDec 2, 2021
  3. Alex Xu (Hello71)Dec 3, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.