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
IDIgor Djordjevic <igor.d.djordjevic@gmail.com>
Date
Aug 21, 2018, 12:10 UTC
Message-ID
<32354ab0-1d17-0be3-679a-75f6287a6bab@gmail.com>
In-Reply-To
<e5f65c19-0f49-d48e-c600-7dfcd95f3218@yandex.ru>
Hi Konstantin,
On 21/08/2018 11:37, Konstantin Kharlamov wrote:
Show 14 quoted lines
> 
> > 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.
> 
> Yeah, thanks, that's what happens. And I'm wondering, is it really 
> needed to raise a conflict there? Would it be worth to just apply the 
> line "3", possibly with a warning or an interactive question to user 
> (apply/raise) that identical parts were ignored?

I see how this might make sense in the given example of "A added 1 and 2, B added 1 and 2 and 3", but I'm afraid that might be a too narrow view.

What we actually don't know is if A deliberately chose not to include 3, or even worse, if A started from having "1 and 2 and 3" in there, and then decided to remove 3.

In both these situation just applying 3 would be wrong, and raising a conflict seems as the most (and only?) sensible solution.

Applying _and_ asking for confirmation might be interesting, but I'm afraid it would favor specific use case only, being an annoyance in all the others (where it should really be a conflict, and you now have additional prompt to deal with).

That said, it would indeed be nice to have a way to communicate to `git rebase` that we are just splitting later commit into smaller parts preceding it, so situations like this could be resolved automatically and without conflicts, as you'd expected - but only within that narrow, user-provided/communicated context, not in general case.

Regards, Buga
Previous: Konstantin Kharlamov
Message 5 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.