Re: git merge bug report

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

focus on the feature 2, the two double empty lines, which one is the new one?
```
    bugger = "fix: the empty lines blow not the new added lines"


class NoMethod:
    pass


class Product
```

Should the second one be newly added? instead of the first

On Tue, 15 Apr 2025 at 22:13, Lucas Seiki Oshiro
<lucasseikioshiro@xxxxxxxxx> wrote:
>
> Hi!
>
> > I would like to report a bug I encountered in Git during a merge
> > operation. The method from one branch was merged into the wrong class,
> > despite there being no reported conflict.
>
> Thanks for your script! I could reproduce this here!
>
> When two branches changes the same plaintext file, Git tries to merge
> them based on their contents without taking into account the syntax.
> It is done using diff algorithms, which you can change using
> `-X diff-algorithm=<algorithm>`.
>
> I tried the four algorithms available (minimal, histogram, myers and
> patience) and all of them produced the same result.
>
> Sadly, they are not infallible and those mistakes may happen. There
> are other cases where it can happen. For example, imagine a Python
> class with only two methods and each branch deletes one of them.
> After merging, it will leave an empty class definition, which is not
> allowed in Python (unless you use `pass`). These algorithms are not
> aware of that, and they'll leave an invalid Python file.
>
> Also note that they are not exactly wrong. They only do their work
> naively based on the information they have.
>
> This way, it's always a good idea to check if the merge went well.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux