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
This commit is contained in:
Shawn Pearce 2014-11-25 16:14:33 -08:00 committed by Shawn Pearce
parent a606dc363d
commit 3886a4f68b
1 changed files with 2 additions and 9 deletions

View File

@ -350,15 +350,8 @@ protected void cleanUp() throws NoWorkTreeException,
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();
}
}