@ -652,43 +652,41 @@ public class ResolveMerger extends ThreeWayMerger {
keep ( ourDce ) ;
// no checkout needed!
return true ;
} else {
}
// same content but different mode on OURS and THEIRS.
// Try to merge the mode and report an error if this is
// not possible.
int newMode = mergeFileModes ( modeB , modeO , modeT ) ;
if ( newMode ! = FileMode . MISSING . getBits ( ) ) {
if ( newMode = = modeO )
if ( newMode = = modeO ) {
// ours version is preferred
keep ( ourDce ) ;
else {
} else {
// the preferred version THEIRS has a different mode
// than ours. Check it out!
if ( isWorktreeDirty ( work , ourDce ) )
if ( isWorktreeDirty ( work , ourDce ) ) {
return false ;
// we know about length and lastMod only after we have written the new content.
}
// we know about length and lastMod only after we have
// written the new content.
// This will happen later. Set these values to 0 for know.
DirCacheEntry e = add ( tw . getRawPath ( ) , theirs ,
DirCacheEntry . STAGE_0 , EPOCH , 0 ) ;
addToCheckout ( tw . getPathString ( ) , e , attributes ) ;
}
return true ;
} else {
}
// FileModes are not mergeable. We found a conflict on modes.
// For conflicting entries we don't know lastModified and length.
// For conflicting entries we don't know lastModified and
// length.
add ( tw . getRawPath ( ) , base , DirCacheEntry . STAGE_1 , EPOCH , 0 ) ;
add ( tw . getRawPath ( ) , ours , DirCacheEntry . STAGE_2 , EPOCH , 0 ) ;
add ( tw . getRawPath ( ) , theirs , DirCacheEntry . STAGE_3 , EPOCH ,
0 ) ;
add ( tw . getRawPath ( ) , theirs , DirCacheEntry . STAGE_3 , EPOCH , 0 ) ;
unmergedPaths . add ( tw . getPathString ( ) ) ;
mergeResults . put (
tw . getPathString ( ) ,
new MergeResult < > ( Collections
. < RawText > emptyList ( ) ) ) ;
}
mergeResults . put ( tw . getPathString ( ) ,
new MergeResult < > ( Collections . < RawText > emptyList ( ) ) ) ;
return true ;
}
}
if ( modeB = = modeT & & tw . idEqual ( T_BASE , T_THEIRS ) ) {
// THEIRS was not changed compared to BASE. All changes must be in
@ -716,7 +714,7 @@ public class ResolveMerger extends ThreeWayMerger {
addToCheckout ( tw . getPathString ( ) , e , attributes ) ;
}
return true ;
} else {
}
// we want THEIRS ... but THEIRS contains a folder or the
// deletion of the path. Delete what's in the working tree,
// which we know to be clean.
@ -731,7 +729,6 @@ public class ResolveMerger extends ThreeWayMerger {
addDeletion ( tw . getPathString ( ) , nonTree ( modeO ) , attributes ) ;
return true ;
}
}
if ( tw . isSubtree ( ) ) {
// file/folder conflicts: here I want to detect only file/folder
@ -1310,11 +1307,10 @@ public class ResolveMerger extends ThreeWayMerger {
if ( getUnmergedPaths ( ) . isEmpty ( ) & & ! failed ( ) ) {
resultTree = dircache . writeTree ( getObjectInserter ( ) ) ;
return true ;
} else {
}
resultTree = null ;
return false ;
}
}
/ * *
* Process the given TreeWalk ' s entries .