diff options
author | Matthew DeVore <matvore@gmail.com> | 2019-03-25 15:36:35 -0700 |
---|---|---|
committer | Matthew DeVore <matvore@gmail.com> | 2019-04-16 10:36:59 -0700 |
commit | 175e66548b78e6d22ad27d62eeb06a77ee4d139d (patch) | |
tree | f0d100a6ffc826437d53edcf0dd3456203f7dfa3 /org.eclipse.jgit.test | |
parent | 93dd2d482abb6202e265226775a4bdd2b64d4209 (diff) | |
download | jgit-175e66548b78e6d22ad27d62eeb06a77ee4d139d.tar.gz jgit-175e66548b78e6d22ad27d62eeb06a77ee4d139d.zip |
tree:<depth> 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 <matvore@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java | 7 |
1 files changed, 7 insertions, 0 deletions
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<InMemoryRepository> 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()); } /** |