From 175e66548b78e6d22ad27d62eeb06a77ee4d139d Mon Sep 17 00:00:00 2001 From: Matthew DeVore Date: Mon, 25 Mar 2019 15:36:35 -0700 Subject: tree: should not traverse overly-deep trees If we are traversing a tree which is too deep, then there is no need to traverse the children. Skipping children is much faster than traversing the possibly thousands of objects which are directly or indirectly referenced by the tree. Change-Id: I6d68cc1d35da48e3288b9cc80356a281ab36863d Signed-off-by: Matthew DeVore --- .../tst/org/eclipse/jgit/transport/UploadPackTest.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'org.eclipse.jgit.test') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java index 5a3f98235b..f5470729db 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java @@ -45,6 +45,7 @@ import org.eclipse.jgit.revwalk.RevBlob; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevTag; import org.eclipse.jgit.revwalk.RevTree; +import org.eclipse.jgit.storage.pack.PackStatistics; import org.eclipse.jgit.transport.UploadPack.RequestPolicy; import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException; import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; @@ -76,6 +77,8 @@ public class UploadPackTest { private TestRepository remote; + private PackStatistics stats; + @Before public void setUp() throws Exception { server = newRepo("server"); @@ -460,6 +463,7 @@ public class UploadPackTest { ByteArrayOutputStream recv = new ByteArrayOutputStream(); up.upload(send, recv, null); + stats = up.getStatistics(); return new ByteArrayInputStream(recv.toByteArray()); } @@ -1630,6 +1634,7 @@ public class UploadPackTest { .has(preparator.blobLowDepth.toObjectId())); assertFalse(client.getObjectDatabase() .has(preparator.blobHighDepth.toObjectId())); + assertEquals(1, stats.getTreesTraversed()); } @Test @@ -1651,6 +1656,7 @@ public class UploadPackTest { .has(preparator.blobLowDepth.toObjectId())); assertFalse(client.getObjectDatabase() .has(preparator.blobHighDepth.toObjectId())); + assertEquals(1, stats.getTreesTraversed()); } @Test @@ -1668,6 +1674,7 @@ public class UploadPackTest { .has(preparator.blobLowDepth.toObjectId())); assertFalse(client.getObjectDatabase() .has(preparator.blobHighDepth.toObjectId())); + assertEquals(2, stats.getTreesTraversed()); } /** -- cgit v1.2.3