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

Re: git-merge-recursive: documentation and implementation notes

From
Fredrik Kuivinen <freku045@student.liu.se>
Date
Nov 13, 2005, 17:12 UTC
Message-ID
<20051113171207.GB4805@c165.ib.student.liu.se>
In-Reply-To
<20051112210306.GG30496@pasky.or.cz>
On Sat, Nov 12, 2005 at 10:03:06PM +0100, Petr Baudis wrote:
Show 21 quoted lines
>   Hi,
> 
> Dear diary, on Sat, Nov 12, 2005 at 09:34:57PM CET, I got a letter
> where Fredrik Kuivinen <freku045@student.liu.se> said that...
> > Lets assume there is a merge conflict when we merge B and C in the
> > criss-cross case above. Then both D and E must resolve this
> > conflict. If they have done it in the same way we wont get a merge
> > conflict at M, if they have resolved it differently we will get a
> > merge conflict. In the first case there is no merge conflict at M, in
> > the second case the user has to pick which one of the two different
> > resolutions she wants.
> > 
> > Note that the algorithm will happily write non-clean merge results to
> > the object database during the "merge common ancestors" stage. Hence,
> > when we are merging B and C "internally" we will _not_ ask the user to
> > resolve any eventual merge conflicts.
> 
>   I find this part somewhat unclear. So how does the user pick which of
> the two different resolution she wants if we will not ask the user to
> resolve any conflicts?
> 

If we have a conflict when we merge B and C we will get a file with conflict markers from merge(1) in it, so it will look something like

    1
    2
    3
    <<<<<<
    4
    5
    ======
    6
    7
    >>>>>>
    8
    9

This file will be stored in the object database and the temporary tree which is created by the merge of B and C will refer to it.

The algorithm will then merge D and E and use the file above as the common ancestor. There are now two cases to consider, the first one is that both D and E resolve the conflict above in the same way (and possible make other changes which can be cleanly merged), we end up with something like

    1
    2
    3
    4
    5
    8
    9

in both D and E. This will be merged cleanly into M. The other case is that D and E either resolves the conflict differently or that they do other modifications which aren't possible to merge automatically. In this case we will let the user do the conflict resolution.

So, what I meant was that during the first merge, of B and C, the user do not have to do anything with any eventual conflicts. However, in the top-level merge, conflict resolution works in the same way as it does for the 'resolve' strategy, i.e., the output of merge(1) is stored in the working directory and the index is updated to make 'git diff' useful.

- Fredrik
Previous: Petr Baudis
Message 3 of 3 in “git-merge-recursive: documentation and implementation notes”
  1. Fredrik KuivinenNov 12, 2005
  2. Petr BaudisNov 12, 2005
  3. Fredrik KuivinenNov 13, 2005

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.