Browse Source

ResolveMerger: Use checkoutEntry during abort

The cleanUp path is trying to restore files that previously were
clean, but were overwritten in the work tree by a partial merge
attempt that has failed and needs to be aborted. Reuse the checkout
logic to write the file content and refresh the stat data.

Change-Id: I320d33b3744daf88d3155db99e957408937ddd00
stable-3.6
Shawn Pearce 10 years ago committed by Shawn Pearce
parent
commit
3886a4f68b
  1. 11
      org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java

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

@ -350,15 +350,8 @@ public class ResolveMerger extends ThreeWayMerger {
while(mpathsIt.hasNext()) {
String mpath=mpathsIt.next();
DirCacheEntry entry = dc.getEntry(mpath);
if (entry == null)
continue;
FileOutputStream fos = new FileOutputStream(new File(
db.getWorkTree(), mpath));
try {
reader.open(entry.getObjectId()).copyTo(fos);
} finally {
fos.close();
}
if (entry != null)
DirCacheCheckout.checkoutEntry(db, entry, reader);
mpathsIt.remove();
}
}

Loading…
Cancel
Save