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

Re: jgit merge question

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 14, 2009, 15:30 UTC
Message-ID
<20090114153034.GZ10179@spearce.org>
In-Reply-To
<alpine.DEB.1.00.0901141124460.3586@pacific.mpi-cbg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 6 quoted lines
> On Wed, 14 Jan 2009, David Birchfield wrote:
> 
> > I have been working with the JGit library and with the pgm files and 
> > other documentation I have been able to implement most of the basic 
> > functions that I need for my testing application - including fetch.  
> > This is great!
I'm glad JGit has been useful for you.
> > However, I have not been able to successfully implement 
> > the merge function with JGit. There is some reference to this in the 
> > mail archive, but I cannot find any of the merge code that is referenced 
> > in the distribution.

David is probably talking about the 8 patch series I proposed to add a crude merge API to JGit. The patches are available here, based on the current JGit master:

  http://android.git.kernel.org/?p=tools/egit.git;a=shortlog;h=refs/heads/for-gerrit2
  git://android.git.kernel.org/tools/egit.git for-gerrit2

as I'm still highly dependent upon this in Gerrit2, but I haven't been able to fix enough bugs and add enough unit tests to make Robin happy with accepting them into the library. I plan to get back to that as soon as Gerrit2 is live for Android.

That API is a very, very crude merge API. I don't like coding with it from the application level. It doesn't give Gerrit2 enough error information when it fails, and that means any other application will also be unhappy with it.

It also has at least one bug, but at least its a conservative bug (it won't merge subtrees sometimes and aborts even though they should have merged clean). Its also missing a huge block of code about head simplification; that block is in Gerrit2 application code rather than down in the library (that was a mistake in design).

So basically, yea, I've proposed something, but there are some very good reasons why there isn't merge support yet in JGit.

> http://thread.gmane.org/gmane.comp.version-control.git/100524/focus=100589
Yea, we also need the diff implementation so we can do file-level
merges.  That merge API above only does path-level merges.  If a
file is modified on both sides, the merge API I use in Gerrit2
just aborts.  That typically isn't what a human who is trying to
use Git for development wants.
 
> Yes, it has not been implemented, basically because it needs a diff 
> implementation, and I constantly run out of time working on it.  I have 
> something that works, but needs lots of improvements to be usable 
> (basically, it has to avoid deep recursion depths).
What's a little stack space between friends?  ;-)
-- 
Shawn.
Previous: Johannes SchindelinNext: David Birchfield
Message 3 of 7 in “jgit merge question”
  1. David BirchfieldJan 14, 2009
  2. Johannes SchindelinJan 14, 2009
  3. Shawn O. PearceJan 14, 2009
  4. David BirchfieldJan 14, 2009
  5. Shawn O. PearceJan 14, 2009
  6. David BirchfieldJan 15, 2009
  7. Shawn O. PearceJan 15, 2009

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.