]> source.dussan.org Git - jgit.git/commitdiff
ResolveMerger: Use checkoutEntry during abort 17/37217/1
authorShawn Pearce <sop@google.com>
Wed, 26 Nov 2014 00:14:33 +0000 (16:14 -0800)
committerShawn Pearce <spearce@spearce.org>
Thu, 27 Nov 2014 21:41:58 +0000 (13:41 -0800)
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

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

index dba89709aa8954c78642385d19840c688b68f3ba..8e70f57fa3ab2a8badbb8588c03d2be9be0186b8 100644 (file)
@@ -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();
                }
        }