diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2012-06-14 12:42:39 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2012-06-14 12:42:39 -0700 |
commit | d0e4943df1040add984c4fa0b32e791647946b2f (patch) | |
tree | 3822e09210d918fad6027970c5903502572fd4ab /org.eclipse.jgit | |
parent | 90003519092c4be2f7806b171cd1c2d37a05f588 (diff) | |
download | jgit-d0e4943df1040add984c4fa0b32e791647946b2f.tar.gz jgit-d0e4943df1040add984c4fa0b32e791647946b2f.zip |
Allow applications to pass ObjectInserter to Merger
Gerrit Code Review needs to control which inserter is used by a
Merger. Allow the application to set the inserter before calling
merge, giving callers more direct control over how objects will
be created.
Change-Id: I3c527a493db4659e95289ff3077cffb9e32336cf
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java index 35df8e1656..fd94cfb23f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java @@ -108,6 +108,8 @@ public abstract class Merger { /** * @return an object writer to create objects in {@link #getRepository()}. + * If no inserter has been set on this instance, one will be created + * and returned by all future calls. */ public ObjectInserter getObjectInserter() { if (inserter == null) @@ -116,6 +118,23 @@ public abstract class Merger { } /** + * Set the inserter this merger will use to create objects. + * <p> + * If an inserter was already set on this instance (such as by a prior set, + * or a prior call to {@link #getObjectInserter()}), the prior inserter will + * be released first. + * + * @param oi + * the inserter instance to use. Must be associated with the + * repository instance returned by {@link #getRepository()}. + */ + public void setObjectInserter(ObjectInserter oi) { + if (inserter != null) + inserter.release(); + inserter = oi; + } + + /** * Merge together two or more tree-ish objects. * <p> * Any tree-ish may be supplied as inputs. Commits and/or tags pointing at |