@ -54,6 +54,7 @@ import java.util.ArrayList;
import java.util.Arrays ;
import java.util.Comparator ;
import java.util.List ;
import java.util.concurrent.TimeUnit ;
import java.util.zip.DataFormatException ;
import java.util.zip.Inflater ;
@ -61,6 +62,7 @@ import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException ;
import org.eclipse.jgit.errors.MissingObjectException ;
import org.eclipse.jgit.lib.AnyObjectId ;
import org.eclipse.jgit.lib.BatchingProgressMonitor ;
import org.eclipse.jgit.lib.Constants ;
import org.eclipse.jgit.lib.InflaterCache ;
import org.eclipse.jgit.lib.MutableObjectId ;
@ -478,6 +480,12 @@ public abstract class PackParser {
if ( ! deferredCheckBlobs . isEmpty ( ) )
doDeferredCheckBlobs ( ) ;
if ( deltaCount > 0 ) {
if ( resolving instanceof BatchingProgressMonitor ) {
( ( BatchingProgressMonitor ) resolving ) . setDelayStart (
1000 ,
TimeUnit . MILLISECONDS ) ;
}
resolving . beginTask ( JGitText . get ( ) . resolvingDeltas , deltaCount ) ;
resolveDeltas ( resolving ) ;
if ( entryCount < objectCount ) {
if ( ! isAllowThin ( ) ) {
@ -494,6 +502,7 @@ public abstract class PackParser {
( objectCount - entryCount ) ) ) ;
}
}
resolving . endTask ( ) ;
}
packDigest = null ;
@ -518,20 +527,17 @@ public abstract class PackParser {
private void resolveDeltas ( final ProgressMonitor progress )
throws IOException {
progress . beginTask ( JGitText . get ( ) . resolvingDeltas , deltaCount ) ;
final int last = entryCount ;
for ( int i = 0 ; i < last ; i + + ) {
final int before = entryCount ;
resolveDeltas ( entries [ i ] ) ;
progress . update ( entryCount - before ) ;
resolveDeltas ( entries [ i ] , progress ) ;
if ( progress . isCancelled ( ) )
throw new IOException (
JGitText . get ( ) . downloadCancelledDuringIndexing ) ;
}
progress . endTask ( ) ;
}
private void resolveDeltas ( final PackedObjectInfo oe ) throws IOException {
private void resolveDeltas ( final PackedObjectInfo oe ,
ProgressMonitor progress ) throws IOException {
UnresolvedDelta children = firstChildOf ( oe ) ;
if ( children = = null )
return ;
@ -559,12 +565,14 @@ public abstract class PackParser {
. getOffset ( ) ) ) ;
}
resolveDeltas ( visit . next ( ) , info . type , info ) ;
resolveDeltas ( visit . next ( ) , info . type , info , progress ) ;
}
private void resolveDeltas ( DeltaVisit visit , final int type ,
ObjectTypeAndSize info ) throws IOException {
ObjectTypeAndSize info , ProgressMonitor progress )
throws IOException {
do {
progress . update ( 1 ) ;
info = openDatabase ( visit . delta , info ) ;
switch ( info . type ) {
case Constants . OBJ_OFS_DELTA :
@ -749,7 +757,8 @@ public abstract class PackParser {
entries [ entryCount + + ] = oe ;
visit . nextChild = firstChildOf ( oe ) ;
resolveDeltas ( visit . next ( ) , typeCode , new ObjectTypeAndSize ( ) ) ;
resolveDeltas ( visit . next ( ) , typeCode ,
new ObjectTypeAndSize ( ) , progress ) ;
if ( progress . isCancelled ( ) )
throw new IOException (