]> source.dussan.org Git - jgit.git/commitdiff
RevWalk: Discard uninteresting commits unless RevSort.BOUNDARY 63/47563/4
authorShawn Pearce <spearce@spearce.org>
Sat, 9 May 2015 05:48:10 +0000 (22:48 -0700)
committerShawn Pearce <spearce@spearce.org>
Sun, 10 May 2015 17:47:09 +0000 (10:47 -0700)
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

org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java

index 593e09e2551e9c125d04f1ce4a48d1e28e7af0a8..02469d6de86915492f079181848eed9fa0f00111 100644 (file)
@@ -144,7 +144,7 @@ class StartGenerator extends Generator {
                } 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.