@ -73,6 +73,7 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger ;
import java.util.concurrent.atomic.AtomicReference ;
import org.eclipse.jgit.annotations.NonNull ;
import org.eclipse.jgit.errors.InvalidObjectIdException ;
import org.eclipse.jgit.errors.LockFailedException ;
import org.eclipse.jgit.errors.MissingObjectException ;
@ -715,16 +716,20 @@ public class RefDirectory extends RefDatabase {
* /
private Ref peeledPackedRef ( Ref f )
throws MissingObjectException , IOException {
if ( f . getStorage ( ) . isPacked ( ) & & f . isPeeled ( ) )
if ( f . getStorage ( ) . isPacked ( ) & & f . isPeeled ( ) ) {
return f ;
if ( ! f . isPeeled ( ) )
}
if ( ! f . isPeeled ( ) ) {
f = peel ( f ) ;
if ( f . getPeeledObjectId ( ) ! = null )
}
ObjectId peeledObjectId = f . getPeeledObjectId ( ) ;
if ( peeledObjectId ! = null ) {
return new ObjectIdRef . PeeledTag ( PACKED , f . getName ( ) ,
f . getObjectId ( ) , f . getPeeledObjectId ( ) ) ;
else
f . getObjectId ( ) , p eeledObjectId) ;
} else {
return new ObjectIdRef . PeeledNonTag ( PACKED , f . getName ( ) ,
f . getObjectId ( ) ) ;
}
}
void log ( final RefUpdate update , final String msg , final boolean deref )
@ -985,7 +990,7 @@ public class RefDirectory extends RefDatabase {
try {
id = ObjectId . fromString ( buf , 0 ) ;
if ( ref ! = null & & ! ref . isSymbolic ( )
& & ref . getTarget ( ) . getObjectId ( ) . equals ( id ) ) {
& & id . equals ( ref . getTarget ( ) . getObjectId ( ) ) ) {
assert ( currentSnapshot ! = null ) ;
currentSnapshot . setClean ( otherSnapshot ) ;
return ref ;
@ -1103,8 +1108,8 @@ public class RefDirectory extends RefDatabase {
implements LooseRef {
private final FileSnapshot snapShot ;
LoosePeeledTag ( FileSnapshot snapshot , String refName , ObjectId id ,
ObjectId p ) {
LoosePeeledTag ( FileSnapshot snapshot , @NonNull String refName ,
@NonNull ObjectId id , @NonNull ObjectId p ) {
super ( LOOSE , refName , id , p ) ;
this . snapShot = snapshot ;
}
@ -1122,7 +1127,8 @@ public class RefDirectory extends RefDatabase {
implements LooseRef {
private final FileSnapshot snapShot ;
LooseNonTag ( FileSnapshot snapshot , String refName , ObjectId id ) {
LooseNonTag ( FileSnapshot snapshot , @NonNull String refName ,
@NonNull ObjectId id ) {
super ( LOOSE , refName , id ) ;
this . snapShot = snapshot ;
}
@ -1140,7 +1146,8 @@ public class RefDirectory extends RefDatabase {
implements LooseRef {
private FileSnapshot snapShot ;
LooseUnpeeled ( FileSnapshot snapShot , String refName , ObjectId id ) {
LooseUnpeeled ( FileSnapshot snapShot , @NonNull String refName ,
@NonNull ObjectId id ) {
super ( LOOSE , refName , id ) ;
this . snapShot = snapShot ;
}
@ -1149,13 +1156,24 @@ public class RefDirectory extends RefDatabase {
return snapShot ;
}
@NonNull
@Override
public ObjectId getObjectId ( ) {
ObjectId id = super . getObjectId ( ) ;
assert id ! = null ; // checked in constructor
return id ;
}
public LooseRef peel ( ObjectIdRef newLeaf ) {
if ( newLeaf . getPeeledObjectId ( ) ! = null )
ObjectId peeledObjectId = newLeaf . getPeeledObjectId ( ) ;
ObjectId objectId = getObjectId ( ) ;
if ( peeledObjectId ! = null ) {
return new LoosePeeledTag ( snapShot , getName ( ) ,
getObjectId ( ) , newLeaf . getPeeledObjectId ( ) ) ;
else
objectId , peeledObjectId ) ;
} else {
return new LooseNonTag ( snapShot , getName ( ) ,
getObjectId ( ) ) ;
objectId ) ;
}
}
}
@ -1163,7 +1181,8 @@ public class RefDirectory extends RefDatabase {
LooseRef {
private final FileSnapshot snapShot ;
LooseSymbolicRef ( FileSnapshot snapshot , String refName , Ref target ) {
LooseSymbolicRef ( FileSnapshot snapshot , @NonNull String refName ,
@NonNull Ref target ) {
super ( refName , target ) ;
this . snapShot = snapshot ;
}