From 8f2b4c8a6e3d53c62804bc7f874231976618364b Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Fri, 3 May 2019 00:23:01 +0200 Subject: [PATCH] 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 --- .../eclipse/jgit/internal/storage/pack/PackWriter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java index 95d8f17a7..b6e6a6c49 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java @@ -881,7 +881,7 @@ public class PackWriter implements AutoCloseable { */ private class DepthAwareVisitationPolicy implements ObjectWalk.VisitationPolicy { - private final Map lowestDepthVisited = new HashMap<>(); + private final Map 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())); } }