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

Re: git-union-merge proposal

From
Johan Herland <johan@herland.net>
Date
Jun 21, 2011, 07:34 UTC
Message-ID
<201106210934.34025.johan@herland.net>
In-Reply-To
<20110621052211.GA16919@elie>
On Tuesday 21 June 2011, Jonathan Nieder wrote:
Show 21 quoted lines
> Joey Hess wrote[1]:
> > * git notes merge -s cat_sort_uniq
> > 
> >   Notes are stored in a tree using the object sha, which can be
> >   union merged, when the notes' format is a series of independant
> >   lines.
> > 
> > [...]
> > 
> > So I've written a prototype of a git-union-merge that could be used
> > for all of these. It works like this:
> > 
> > git union-merge foo origin/foo refs/heads/foo
> 
> [...]
> 
> If the prototype were self-contained, I would encourage you to submit
> it for inclusion under contrib/ so it can evolve and eventually
> graduate out of there.  Cc-ing Johan (who has no doubt thought through
> these things in the context of "git notes") in case he has thoughts on
> it.
Thanks for the CC.

I must confess that my Haskell skills are exactly nil, but AFAICS the script depends on the filename as the only criteria to identify files that need a line-level merge. How does the script deal with renamed and copied files?

If you depend on the filename only, this script simply will not work for notes. The notes tree reorganizes itself dynamically for optimum performance, and this affects how notes trees can be merged.

E.g. given a note for object 01234567..., this note may exist as "01234567..." in one notes tree, while it may exist as "01/234567..." in a bigger notes tree, or even "01/23/4567..." in an even bigger notes tree. Even though the filenames differ, they all refer to the same note, and you cannot merge notes trees correctly without taking that fact into account.

Furthermore, if you (union-)merge two notes trees that both have "01/234567...", the result does not necessarily belong in "01/234567...". It could be that the sum/union of the two notes trees have pushed the number of notes in the result so high that "01/23/4567..." is now a more optimal name for this note.

...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: Jonathan NiederNext: Joey Hess
Message 3 of 8 in “git-union-merge proposal”
  1. Joey HessJun 21, 2011
  2. Jonathan NiederJun 21, 2011
  3. Johan HerlandJun 21, 2011
  4. Joey HessJun 21, 2011
  5. Junio C HamanoJun 21, 2011
  6. Junio C HamanoJun 21, 2011
  7. Joey HessJun 21, 2011
  8. Junio C HamanoJun 21, 2011

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.