From: Jonathan Tan Date: Wed, 12 Sep 2018 19:49:40 +0000 (-0700) Subject: DepthGenerator: remove redundant depth check X-Git-Tag: v5.2.0.201811281532-m3~140 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=953cf2c9dab3ee2a4e1fefa87ea87c7b8b1eb18f;p=jgit.git DepthGenerator: remove redundant depth check 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 --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java index eaec305b47..3e96f5a170 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java @@ -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.