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

Re: How to populate index/worktree when recursive merge merges multiple common ancestors?

From
Shawn Pearce <spearce@spearce.org>
Date
Jun 27, 2014, 15:31 UTC
Message-ID
<CAJo=hJtLzMqrBf5Y1dzUxi_0nGmY72xURRmcvmjoFD+=j0FCwQ@mail.gmail.com>
In-Reply-To
<CAENte7jg7RnpEFmZ0QWGw=a-AvAN6AF=cknHXWyTEuo9zq7ERg@mail.gmail.com>

On Thu, Jun 26, 2014 at 10:50 PM, Christian Halstrick <christian.halstrick@gmail.com> wrote:

> Imagine git does a recursive merge between A and B and finds multiple
> common ancestors X1,X2 for these commits.
> - Does git try to create an implicit/temporary common ancestor X3 by
> merging X1 and X2?

Yes this is the point of the recursive merge algorithm. When >1 common ancestor is found they are merged. If those again have >1 common ancestor, it proceeds recursively. :)

> - How should workingtree, index (stage1,2,3) look like if during that
> merge of common ancestors a conflict occurs? Will I see in stage2 and
> stage3 really see content of X1 and X2?

Its done entirely in memory and never touches the working tree or index. When a conflict exists in the X1-X2 merge the conflict is preserved into the new virtual base.

> - How is the end user supposed to fix this? Imaging merging X1 and X2
> leads to conflicts solved by the end user leading to a implicit common
> ancestor X3. Then merging A and B with X3 as common base again
> conflicts occur.

They don't. The conflicts are preserved into the virtual ancestor. The user only sees the final conflicts during merging of A and B with virtual X3 as the common ancestor.

Show 7 quoted lines
>
> Ciao
>   Chris
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Christian HalstrickNext: Christian Halstrick
Message 2 of 4 in “How to populate index/worktree when recursive merge merges multiple common ancestors?”
  1. Christian HalstrickJun 27, 2014
  2. Shawn PearceJun 27, 2014
  3. Christian HalstrickJun 30, 2014
  4. Shawn PearceJun 30, 2014

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.