]> source.dussan.org Git - jgit.git/commitdiff
ReceivePack: Micro-optimize object lookup when checking connectivity 74/574/1
authorShawn O. Pearce <spearce@spearce.org>
Fri, 16 Apr 2010 23:37:29 +0000 (16:37 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 17 Apr 2010 00:04:38 +0000 (17:04 -0700)
If we are checking the visibility of everything referenced in the
pack that isn't already reachable by a reference, it needs to be
in the provided set.  Since the provided set lists everything that
is in this pack, we can avoid checking to see if the blob exists
on disk, because we know it should be there, it was found in the
pack we just consumed.

Change-Id: Ie3c7746f734d13077242100a68e048f1ac18c34a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java

index 85522edc49a9cbe4d43282d9c8a119d03441b860..7c113d65f67cf9c9520fd797cb0d7b522dfe4643 100644 (file)
@@ -823,11 +823,15 @@ public class ReceivePack {
 
                RevObject o;
                while ((o = ow.nextObject()) != null) {
+                       if (ensureObjectsProvidedVisible) {
+                               if (providedObjects.contains(o))
+                                       continue;
+                               else
+                                       throw new MissingObjectException(o, o.getType());
+                       }
+
                        if (o instanceof RevBlob && !db.hasObject(o))
                                throw new MissingObjectException(o, Constants.TYPE_BLOB);
-
-                       if (ensureObjectsProvidedVisible && !providedObjects.contains(o))
-                               throw new MissingObjectException(o, o.getType());
                }
        }