@ -81,7 +81,6 @@ import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.ConfigConstants ;
import org.eclipse.jgit.lib.ConfigConstants ;
import org.eclipse.jgit.lib.FileMode ;
import org.eclipse.jgit.lib.FileMode ;
import org.eclipse.jgit.lib.ObjectId ;
import org.eclipse.jgit.lib.ObjectId ;
import org.eclipse.jgit.lib.ObjectReader ;
import org.eclipse.jgit.lib.Repository ;
import org.eclipse.jgit.lib.Repository ;
import org.eclipse.jgit.revwalk.RevTree ;
import org.eclipse.jgit.revwalk.RevTree ;
import org.eclipse.jgit.treewalk.AbstractTreeIterator ;
import org.eclipse.jgit.treewalk.AbstractTreeIterator ;
@ -309,13 +308,11 @@ public class ResolveMerger extends ThreeWayMerger {
}
}
private void checkout ( ) throws NoWorkTreeException , IOException {
private void checkout ( ) throws NoWorkTreeException , IOException {
ObjectReader r = db . getObjectDatabase ( ) . newReader ( ) ;
try {
for ( Map . Entry < String , DirCacheEntry > entry : toBeCheckedOut
for ( Map . Entry < String , DirCacheEntry > entry : toBeCheckedOut
. entrySet ( ) ) {
. entrySet ( ) ) {
File f = new File ( db . getWorkTree ( ) , entry . getKey ( ) ) ;
File f = new File ( db . getWorkTree ( ) , entry . getKey ( ) ) ;
createDir ( f . getParentFile ( ) ) ;
createDir ( f . getParentFile ( ) ) ;
DirCacheCheckout . checkoutEntry ( db , f , entry . getValue ( ) , r ) ;
DirCacheCheckout . checkoutEntry ( db , f , entry . getValue ( ) , reade r) ;
modifiedFiles . add ( entry . getKey ( ) ) ;
modifiedFiles . add ( entry . getKey ( ) ) ;
}
}
// Iterate in reverse so that "folder/file" is deleted before
// Iterate in reverse so that "folder/file" is deleted before
@ -330,9 +327,6 @@ public class ResolveMerger extends ThreeWayMerger {
MergeFailureReason . COULD_NOT_DELETE ) ;
MergeFailureReason . COULD_NOT_DELETE ) ;
modifiedFiles . add ( fileName ) ;
modifiedFiles . add ( fileName ) ;
}
}
} finally {
r . release ( ) ;
}
}
}
private void createDir ( File f ) throws IOException {
private void createDir ( File f ) throws IOException {
@ -368,7 +362,6 @@ public class ResolveMerger extends ThreeWayMerger {
}
}
DirCache dc = db . readDirCache ( ) ;
DirCache dc = db . readDirCache ( ) ;
ObjectReader or = db . getObjectDatabase ( ) . newReader ( ) ;
Iterator < String > mpathsIt = modifiedFiles . iterator ( ) ;
Iterator < String > mpathsIt = modifiedFiles . iterator ( ) ;
while ( mpathsIt . hasNext ( ) ) {
while ( mpathsIt . hasNext ( ) ) {
String mpath = mpathsIt . next ( ) ;
String mpath = mpathsIt . next ( ) ;
@ -378,7 +371,7 @@ public class ResolveMerger extends ThreeWayMerger {
FileOutputStream fos = new FileOutputStream ( new File (
FileOutputStream fos = new FileOutputStream ( new File (
db . getWorkTree ( ) , mpath ) ) ;
db . getWorkTree ( ) , mpath ) ) ;
try {
try {
o r. open ( entry . getObjectId ( ) ) . copyTo ( fos ) ;
reade r. open ( entry . getObjectId ( ) ) . copyTo ( fos ) ;
} finally {
} finally {
fos . close ( ) ;
fos . close ( ) ;
}
}