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