@ -46,6 +46,7 @@ package org.eclipse.jgit.api;
import java.io.IOException ;
import java.text.MessageFormat ;
import java.util.Arrays ;
import java.util.Collections ;
import java.util.LinkedList ;
import java.util.List ;
import java.util.Map ;
@ -122,6 +123,7 @@ public class MergeCommand extends GitCommand<MergeResult> {
Integer . valueOf ( commits . size ( ) ) ) ) ;
RevWalk revWalk = null ;
DirCacheCheckout dco = null ;
try {
Ref head = repo . getRef ( Constants . HEAD ) ;
if ( head = = null )
@ -147,7 +149,7 @@ public class MergeCommand extends GitCommand<MergeResult> {
ObjectId headId = head . getObjectId ( ) ;
if ( headId = = null ) {
revWalk . parseHeaders ( srcCommit ) ;
DirCacheCheckout dco = new DirCacheCheckout ( repo ,
dco = new DirCacheCheckout ( repo ,
repo . lockDirCache ( ) , srcCommit . getTree ( ) ) ;
dco . setFailOnConflict ( true ) ;
dco . checkout ( ) ;
@ -176,7 +178,7 @@ public class MergeCommand extends GitCommand<MergeResult> {
// FAST_FORWARD detected: skip doing a real merge but only
// update HEAD
refLogMessage . append ( ": " + MergeStatus . FAST_FORWARD ) ;
DirCacheCheckout dco = new DirCacheCheckout ( repo ,
dco = new DirCacheCheckout ( repo ,
headCommit . getTree ( ) , repo . lockDirCache ( ) ,
srcCommit . getTree ( ) ) ;
dco . setFailOnConflict ( true ) ;
@ -214,7 +216,7 @@ public class MergeCommand extends GitCommand<MergeResult> {
refLogMessage . append ( mergeStrategy . getName ( ) ) ;
refLogMessage . append ( '.' ) ;
if ( noProblems ) {
DirCacheCheckout dco = new DirCacheCheckout ( repo ,
dco = new DirCacheCheckout ( repo ,
headCommit . getTree ( ) , repo . lockDirCache ( ) ,
merger . getResultTreeId ( ) ) ;
dco . setFailOnConflict ( true ) ;
@ -250,6 +252,10 @@ public class MergeCommand extends GitCommand<MergeResult> {
}
}
}
} catch ( org . eclipse . jgit . errors . CheckoutConflictException e ) {
List < String > conflicts = ( dco = = null ) ? Collections
. < String > emptyList ( ) : dco . getConflicts ( ) ;
throw new CheckoutConflictException ( conflicts , e ) ;
} catch ( IOException e ) {
throw new JGitInternalException (
MessageFormat . format (