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

Re: Do not raise conflict when a code in a patch was already added

From
Johannes Sixt <j6t@kdbg.org>
Date
Aug 20, 2018, 19:22 UTC
Message-ID
<0d36d185-23d5-a656-67dd-5df86abed3e9@kdbg.org>
In-Reply-To
<ab5021a9-6980-b96c-9d51-cc301844f2af@talktalk.net>
Am 20.08.2018 um 19:40 schrieb Phillip Wood:
Show 13 quoted lines
> On 20/08/2018 11:22, Konstantin Kharlamov wrote:
>> It's spectacular, that content of one of inserted conflict markers is
>> empty, so all you have to do is to remove the markers, and use `git add`
>> on the file, and then `git rebase --continue`
>>
>> Its a lot of unncessary actions, git could just figure that the code it
>> sees in the patch is already there, being a part of another commit.
> 
> If there are conflict markers where one side is empty it means that some
> lines from the merge base (which for a rebase is the parent of the
> commit being picked) have been deleted on one side and modified on the
> other. Git cannot know if you want to use the deleted version or the
> modified version.

There's another possibility (and I think it is what happens actually in Konstantin's case): When one side added lines 1 2 and the other side added 1 2 3, then the actual conflict is << 1 2 == 1 2 3 >>, but our merge code is able to move the identical part out of the conflicted section: 1 2 << == 3 >>. But this is just a courtesy for the user; the real conflict is the original one. Without this optimization, the work to resolve the conflict would be slightly more arduous.

-- Hannes
Previous: Phillip WoodNext: Konstantin Kharlamov
Message 3 of 5 in “Do not raise conflict when a code in a patch was already added”
  1. Konstantin KharlamovAug 20, 2018
  2. Phillip WoodAug 20, 2018
  3. Johannes SixtAug 20, 2018
  4. Konstantin KharlamovAug 21, 2018
  5. Igor DjordjevicAug 21, 2018

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.