automatic merging of "set of lines" text files with a specific git merge driver (union?)

Dieter Plaetinck dieter at plaetinck.be
Mon Feb 21 18:16:34 CET 2011


On Sun, 20 Feb 2011 18:59:16 +0000
seanh <snhmnd at gmail.com> wrote:

> On Sun, Feb 20, 2011 at 06:34:02PM +0100, Dieter Plaetinck wrote:
> > Hi, do you have any text files that are nothing more then an
> > "unordered set of lines"?  More specifically, files where: *
> > location/ordering of lines is not (very) important or relevant * new
> > lines can be added anywhere within the file, on arbitrary locations
> > * deleting a line means "I want this line gone from the file,
> > wherever it is"
> > 
> > I surely have them.  Simple todo lists, notes, shell history, GTD
> > inbox files, browser history, etc
> 
> Really? I keep my todo tasks and notes in text files, but I don't
> consider the order of those items to be random or unimportant. I want
> my todo tasks and notes to appear in the file in the order that I
> created them. Also for shell history, browser history, etc., surely
> these items are chronologically ordered?

I thought it would be clear enough if I added the word "simple",
guess not. Obviously I also have note files where order does matter,
but I also have some where it doesn't.  And surely, history files are
chronologically ordered, but I meant I don't really care much about the
order.
Admittely, if I can solve my problem and keep the order more or less  intact, that's of course great.  What I meant was: for
some files I prefer automatic merges with changed order, rather then
merge conflict because some merge tool is trying to be pedantic about
 details.

 
> Git does do a terrible job of merging these files though. Here's an
> earlier email I wrote about the problem as I see it:
> 
> http://lists.madduck.net/pipermail/vcs-home/2010-April/000253.html
> 
> As suggested in that thread, I think a "patience merge" based on the
> patience diff algorithm might handle them well. Git comes with an
> implementation of patience diff. I think you could do it with a custom
> merge driver. Also, I think bzr does this kind of merge by default.

I think the use case I described is just some generalisation (or
specification, depending on how you look at it) of the problem you
described.
So if patience merge was your magical solution, then I should definitely
try it.  However, since merging and diffing are really very different
things, I should look into how the patience merging algorithm works, and
if it would even help in my (or your case).  The diff algorithm seems
clever, I might enable it by default just to see how it works.

So, what's your experience with the patience merge?

Dieter


More information about the vcs-home mailing list