]> source.dussan.org Git - jgit.git/commitdiff
DepthGenerator: remove redundant depth check 84/129284/2
authorJonathan Tan <jonathantanmy@google.com>
Wed, 12 Sep 2018 19:49:40 +0000 (12:49 -0700)
committerJonathan Tan <jonathantanmy@google.com>
Thu, 27 Sep 2018 21:35:29 +0000 (14:35 -0700)
In DepthGenerator, commits are always added to the "pending" queue
either at depth 0 (in the constructor) or after a depth check (in
next()), so it is redundant to check for depth after removing them from
the queue. Remove the check.

This redundancy seems to have been present since the introduction of
server-side shallow clone support in commit 9952223e06 ("Implement
server support for shallow clones", 2011-08-21).

Change-Id: Iad334935293367400c2901a25c0f4bf36c437cf2
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java

index eaec305b47f73ad8b4909307076bc10154e764bf..3e96f5a170a6e754c6cd4eb281bcd675a36900db 100644 (file)
@@ -160,8 +160,7 @@ class DepthGenerator extends Generator {
                                }
                        }
 
-                       // Produce all commits less than the depth cutoff
-                       boolean produce = c.depth <= depth;
+                       boolean produce = true;
 
                        // Unshallow commits are uninteresting, but still need to be sent
                        // up to the PackWriter so that it will exclude objects correctly.