Browse Source

Use integer depth in PackWriter's DepthAwareVisitationPolicy

- 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>
stable-5.4
Matthias Sohn 6 years ago
parent
commit
8f2b4c8a6e
  1. 8
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java

8
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java

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

Loading…
Cancel
Save