diff options
author | Minh Thai <mthai@google.com> | 2019-03-06 15:25:10 -0800 |
---|---|---|
committer | Minh Thai <mthai@google.com> | 2019-03-06 15:29:59 -0800 |
commit | cc2a223fea20975b04d9c4d0b4febf1c7b3937a4 (patch) | |
tree | 24e5ee517466f6df4e18b69657b5ba15ffd7902a /org.eclipse.jgit/src/org/eclipse/jgit | |
parent | e48410ae9a26b8bac282e863f0c4969ce1a34fe2 (diff) | |
download | jgit-cc2a223fea20975b04d9c4d0b4febf1c7b3937a4.tar.gz jgit-cc2a223fea20975b04d9c4d0b4febf1c7b3937a4.zip |
Do not retain commit body in RevWalk for reachability checks
Commit body contains the message that is not needed for reachability checks, and
takes up memory unnecessarily.
Change-Id: I0c7f6da249bf9c4fda9dc9e62e809322c68effce
Signed-off-by: Minh Thai <mthai@google.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit')
6 files changed, 8 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java index 83394bb92c..384273dffc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java @@ -315,6 +315,7 @@ public class DfsReftableDatabase extends DfsRefDatabase { throws IOException { ReceiveCommand cmd = toCommand(oldRef, newRef); try (RevWalk rw = new RevWalk(getRepository())) { + rw.setRetainBody(false); newBatchUpdate().setAllowNonFastForwards(true).addCommand(cmd) .execute(rw, NullProgressMonitor.INSTANCE); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java index 1ce1528344..7841627666 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java @@ -599,6 +599,7 @@ public abstract class RefUpdate { */ public Result update() throws IOException { try (RevWalk rw = new RevWalk(getRepository())) { + rw.setRetainBody(false); return update(rw); } } @@ -646,6 +647,7 @@ public abstract class RefUpdate { */ public Result delete() throws IOException { try (RevWalk rw = new RevWalk(getRepository())) { + rw.setRetainBody(false); return delete(rw); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index a61897a652..625ddf1017 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -489,6 +489,7 @@ public abstract class Repository implements AutoCloseable { throws AmbiguousObjectException, IncorrectObjectTypeException, RevisionSyntaxException, IOException { try (RevWalk rw = new RevWalk(this)) { + rw.setRetainBody(false); Object resolved = resolve(rw, revstr); if (resolved instanceof String) { final Ref ref = findRef((String) resolved); @@ -515,6 +516,7 @@ public abstract class Repository implements AutoCloseable { public String simplify(String revstr) throws AmbiguousObjectException, IOException { try (RevWalk rw = new RevWalk(this)) { + rw.setRetainBody(true); Object resolved = resolve(rw, revstr); if (resolved != null) if (resolved instanceof String) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java index ed7465c82a..d54ae10f69 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java @@ -272,6 +272,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection if (local != null) { walk = new RevWalk(local); + walk.setRetainBody(false); reachableCommits = new RevCommitList<>(); REACHABLE = walk.newFlag("REACHABLE"); //$NON-NLS-1$ COMMON = walk.newFlag("COMMON"); //$NON-NLS-1$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java index 6f17620d91..2946e98357 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java @@ -314,6 +314,7 @@ public abstract class BaseReceivePack { protected BaseReceivePack(Repository into) { db = into; walk = new RevWalk(db); + walk.setRetainBody(false); TransferConfig tc = db.getConfig().get(TransferConfig.KEY); objectChecker = tc.newReceiveObjectChecker(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java index 681ae125cb..e584440b3f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java @@ -200,6 +200,7 @@ class FetchProcess { .setAllowNonFastForwards(true) .setRefLogMessage("fetch", true); //$NON-NLS-1$ try (RevWalk walk = new RevWalk(transport.local)) { + walk.setRetainBody(false); if (monitor instanceof BatchingProgressMonitor) { ((BatchingProgressMonitor) monitor).setDelayStart( 250, TimeUnit.MILLISECONDS); |