From af7dcd6e1b22d21f4563a75181c5d269fd8105b5 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Fri, 8 May 2015 22:48:10 -0700 Subject: [PATCH] RevWalk: Discard uninteresting commits unless RevSort.BOUNDARY Previously using an ObjectWalk meant uninteresting commits may keep their commit message buffers in memory just in case they were found to be on the boundary and were output as UNINTERESTING for the caller. This was incorrect inside StartGenerator. ObjectWalk hides these internal UNINTERESTING cases from its caller unless RevSort.BOUNDARY was explicitly set, and its false by default. Callers never see one of these saved uninteresting commits. Change the test to allow early dispose unless the application has explicitly asked for RevSort.BOUNDARY. This allows uninteresting commit buffers to be discarded and garbage collected in ObjectWalks when the caller will never be given the RevCommit. Change-Id: Ic1419cc1d9ee95f4d09386dd0730d54c12dcc157 --- .../src/org/eclipse/jgit/revwalk/StartGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java index 593e09e25..02469d6de 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java @@ -144,7 +144,7 @@ RevCommit next() throws MissingObjectException, } else { g = new PendingGenerator(w, pending, rf, pendingOutputType); - if (boundary) { + if (walker.hasRevSort(RevSort.BOUNDARY)) { // Because the boundary generator may produce uninteresting // commits we cannot allow the pending generator to dispose // of them early.