Browse Source

Use only a single ObjectInserter in ResolveMerger

The base class supplies an ObjectInserter to its implementations
by way of the getObjectInserter method. Tracking a second inserter
instance doesn't match with the expected behavior.

Change-Id: I78996bd06ef9028c8aa2e4e192ff647c43da847d
stable-2.1
Shawn O. Pearce 13 years ago
parent
commit
b3dbf1981b
  1. 8
      org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java

8
org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java

@ -131,8 +131,6 @@ public class ResolveMerger extends ThreeWayMerger {
private Map<String, MergeFailureReason> failingPaths = new HashMap<String, MergeFailureReason>(); private Map<String, MergeFailureReason> failingPaths = new HashMap<String, MergeFailureReason>();
private ObjectInserter oi;
private boolean enterSubtree; private boolean enterSubtree;
private boolean inCore; private boolean inCore;
@ -155,7 +153,6 @@ public class ResolveMerger extends ThreeWayMerger {
SupportedAlgorithm.HISTOGRAM); SupportedAlgorithm.HISTOGRAM);
mergeAlgorithm = new MergeAlgorithm(DiffAlgorithm.getAlgorithm(diffAlg)); mergeAlgorithm = new MergeAlgorithm(DiffAlgorithm.getAlgorithm(diffAlg));
commitNames = new String[] { "BASE", "OURS", "THEIRS" }; commitNames = new String[] { "BASE", "OURS", "THEIRS" };
oi = getObjectInserter();
this.inCore = inCore; this.inCore = inCore;
if (inCore) { if (inCore) {
@ -226,7 +223,7 @@ public class ResolveMerger extends ThreeWayMerger {
} }
if (getUnmergedPaths().isEmpty()) { if (getUnmergedPaths().isEmpty()) {
resultTree = dircache.writeTree(oi); resultTree = dircache.writeTree(getObjectInserter());
return true; return true;
} else { } else {
resultTree = null; resultTree = null;
@ -624,7 +621,8 @@ public class ResolveMerger extends ThreeWayMerger {
dce.setLength((int) of.length()); dce.setLength((int) of.length());
InputStream is = new FileInputStream(of); InputStream is = new FileInputStream(of);
try { try {
dce.setObjectId(oi.insert(Constants.OBJ_BLOB, of.length(), is)); dce.setObjectId(getObjectInserter().insert(
Constants.OBJ_BLOB, of.length(), is));
} finally { } finally {
is.close(); is.close();
if (inCore) if (inCore)

Loading…
Cancel
Save