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

Re: [PATCH] A new merge algorithm, take 2

From
Junio C Hamano <junkio@cox.net>
Date
Aug 28, 2005, 05:23 UTC
Message-ID
<7vmzn2prck.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20050827205135.GB16587@c165.ib.student.liu.se>
Fredrik Kuivinen <freku045@student.liu.se> writes:
Show 8 quoted lines
> The main changes compared to the previous version are:
>
> * Lots of clean up.
> * Some of the scripts have been renamed to better match the naming
>   convention used in Git.
> * A new option ('-s') has been added to git-merge-cache
> * Unclean merges are detected and reported
> * Clean merges are committed

I have not looked deeply into your Graph thing, so I'd comment only on a couple of points in the external interfaces area.

I am not sure why you need to be touching merge-cache. I suspect that reading directly from "ls-files --stage -z" might be easier and certainly less intrusive. I do not have immediate objections to "read-tree -i", though. I think it is useful.

When there is a merge conflict, the current code leaves the index in unmerged state and intermediate merge result with conflict marker is left in the working tree. It appears that your code changes this and puts the blob with conflict markers in the index file. Leaving things in unmerged state has two advantages:

 - you _could_ run git-diff-stages to see what the changes in
   both sides are.
 - you cannot accidentally make a commit from such an index file
   state; in fact you cannot even write it out as a tree.

I understand why you do it this way, and I do not find your way _too_ problematic, but we do need to realize that this is making things somewhat more prone to human errors.

I have to admit that I find that "even when merging the merge-base candidates results in a file with conflict markers in it, the parts with the conflict markers often gets changed in the heads being merged, and the conflict markers will be gone from the result" trick very cute and interesting. By itself it has certain amusement value, and if it works well in practice that is great.

> +print 'Merging', h1, 'with', h2
> +h1 = runProgram(['git-rev-parse', '--revs-only', h1]).rstrip()
> +h2 = runProgram(['git-rev-parse', '--revs-only', h2]).rstrip()
Here, '--verify" would be the right flag to give to these.  Perhaps:
    h1 = runProgram(['git-rev-parse', '--verify', ('%s^0' % h1)]).rstrip()
Previous: Fredrik KuivinenNext: Fredrik Kuivinen
Message 2 of 4 in “A new merge algorithm, take 2”
  1. A new merge algorithm, take 2Fredrik Kuivinen, Aug 27, 2005
  2. Junio C HamanoAug 28, 2005
  3. Fredrik KuivinenAug 28, 2005
  4. Junio C HamanoAug 28, 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.