]> source.dussan.org Git - jgit.git/commitdiff
Use integer depth in PackWriter's DepthAwareVisitationPolicy 48/141548/2
authorMatthias Sohn <matthias.sohn@sap.com>
Thu, 2 May 2019 22:23:01 +0000 (00:23 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Fri, 3 May 2019 10:43:59 +0000 (12:43 +0200)
- ObjectWalk.getTreeDepth() returns int hence there is no need to use
long depths in the lowestDepthVisited map.
- Also fix boxing warnings introduced in 0a15cb3a.

Change-Id: I6d73b6f41d5d20975d02f376c8588e411eaff0ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java

index 95d8f17a7b79a076a7059ca00aba9bf409de01ab..b6e6a6c497e666c271ee2c3b8b1737de4aa3f223 100644 (file)
@@ -881,7 +881,7 @@ public class PackWriter implements AutoCloseable {
         */
        private class DepthAwareVisitationPolicy
                        implements ObjectWalk.VisitationPolicy {
-               private final Map<ObjectId, Long> lowestDepthVisited = new HashMap<>();
+               private final Map<ObjectId, Integer> lowestDepthVisited = new HashMap<>();
 
                private final ObjectWalk walk;
 
@@ -891,16 +891,16 @@ public class PackWriter implements AutoCloseable {
 
                @Override
                public boolean shouldVisit(RevObject o) {
-                       Long lastDepth = lowestDepthVisited.get(o);
+                       Integer lastDepth = lowestDepthVisited.get(o);
                        if (lastDepth == null) {
                                return true;
                        }
-                       return walk.getTreeDepth() < lastDepth;
+                       return walk.getTreeDepth() < lastDepth.intValue();
                }
 
                @Override
                public void visited(RevObject o) {
-                       lowestDepthVisited.put(o, (long) walk.getTreeDepth());
+                       lowestDepthVisited.put(o, Integer.valueOf(walk.getTreeDepth()));
                }
        }