@ -659,11 +659,7 @@ public class RevWalk implements Iterable<RevCommit> {
public RevCommit parseCommit ( final AnyObjectId id )
throws MissingObjectException , IncorrectObjectTypeException ,
IOException {
RevObject c = parseAny ( id ) ;
while ( c instanceof RevTag ) {
c = ( ( RevTag ) c ) . getObject ( ) ;
parseHeaders ( c ) ;
}
RevObject c = peel ( parseAny ( id ) ) ;
if ( ! ( c instanceof RevCommit ) )
throw new IncorrectObjectTypeException ( id . toObjectId ( ) ,
Constants . TYPE_COMMIT ) ;
@ -690,11 +686,7 @@ public class RevWalk implements Iterable<RevCommit> {
public RevTree parseTree ( final AnyObjectId id )
throws MissingObjectException , IncorrectObjectTypeException ,
IOException {
RevObject c = parseAny ( id ) ;
while ( c instanceof RevTag ) {
c = ( ( RevTag ) c ) . getObject ( ) ;
parseHeaders ( c ) ;
}
RevObject c = peel ( parseAny ( id ) ) ;
final RevTree t ;
if ( c instanceof RevCommit )
@ -802,6 +794,29 @@ public class RevWalk implements Iterable<RevCommit> {
obj . parseBody ( this ) ;
}
/ * *
* Peel back annotated tags until a non - tag object is found .
*
* @param obj
* the starting object .
* @return If { @code obj } is not an annotated tag , { @code obj } . Otherwise
* the first non - tag object that { @code obj } references . The
* returned object ' s headers have been parsed .
* @throws MissingObjectException
* a referenced object cannot be found .
* @throws IOException
* a pack file or loose object could not be read .
* /
public RevObject peel ( RevObject obj ) throws MissingObjectException ,
IOException {
while ( obj instanceof RevTag ) {
parseHeaders ( obj ) ;
obj = ( ( RevTag ) obj ) . getObject ( ) ;
}
parseHeaders ( obj ) ;
return obj ;
}
/ * *
* Create a new flag for application use during walking .
* < p >