protected void addCommitsAsPageOfChildren ( Git git , Repository repository , CallSpecification spec , PageWriter writer , PageKey pageKey ) throws GitAPIException , IOException { RevWalk walker = new RevWalk ( repository ) ; try { // The offset is the ID of the last commit we read, so we'll need to skip the first commit String lastCommitIdName = pageKey . getOffsetString ( ) ; ObjectId lastCommitId = repository . resolve ( lastCommitIdName ) ; int pageSize = ( int ) pageKey . getBlockSize ( ) ; LogCommand command = git . log ( ) ; command . add ( lastCommitId ) ; command . setMaxCount ( pageSize + 1 ) ; // Add the first set of commits ... int actual = 0 ; String commitId = null ; for ( RevCommit commit : command . call ( ) ) { commitId = commit . getName ( ) ; if ( commitId . equals ( lastCommitIdName ) ) continue ; writer . addChild ( spec . childId ( commitId ) , commitId ) ; ++ actual ; } if ( actual == pageSize ) { assert commitId != null ; // We wrote the maximum number of commits, so there's (probably) another page ... writer . addPage ( pageKey . getParentId ( ) , commitId , pageSize , PageWriter . UNKNOWN_TOTAL_SIZE ) ; } } finally { walker . dispose ( ) ; } }
Add an additional page of commits in the history names of the tags as children of the current node .