Community
Participate
Working Groups
Using 5.6.0.201910092056 jgit. I've had History view opened and "Show first parent only" on, but "Show all branches" off. Then I've toggled "Show all branches" and got this NPE few seconds later (we have ~8000 branches). I could not reproduce that. java.lang.NullPointerException at org.eclipse.jgit.revwalk.TopoSortGenerator.<init>(TopoSortGenerator.java:87) at org.eclipse.jgit.revwalk.StartGenerator.next(StartGenerator.java:172) at org.eclipse.jgit.revwalk.RevWalk.next(RevWalk.java:467) at org.eclipse.jgit.revplot.PlotWalk.next(PlotWalk.java:151) at org.eclipse.egit.ui.internal.history.SWTWalk.next(SWTWalk.java:58) at org.eclipse.egit.ui.internal.history.GitHistoryWalk.next(GitHistoryWalk.java:57) at org.eclipse.jgit.revwalk.RevCommitList.fillTo(RevCommitList.java:307) at org.eclipse.egit.ui.internal.history.GenerateHistoryJob.run(GenerateHistoryJob.java:105) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
I think that's a bug in RewriteGenerator. for (int i = 0; i < nParents; i++) { final RevCommit oldp = pList[i]; if (firstParent && i > 0) { /// (1) c.parents = new RevCommit[] { rewrite(oldp) }; /// (2) return c; } final RevCommit newp = rewrite(oldp); if (oldp != newp) { pList[i] = newp; rewrote = true; } } if (rewrote) { c.parents = cleanup(pList); } (2) is IMO the problem leading to the NPE: rewrite can return null, and then there's a commit with a null in its parent array, which causes the NPE in TopoSortGenerator:87. But I struggle to write a test reproducing this. I had written a test and it failed as expected the first time. But not anymore since then. Huh??? Moreover, I don't understand (1) at all. Why "&& i > 0"?? To me that looks as if in some case first-parent would actually take the second parent. But for that I haven't succeeded to write a failing test either. Puzzled...
New Gerrit change created: https://git.eclipse.org/r/151657
Gerrit change https://git.eclipse.org/r/151657 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=1daf6f13aa4a77c32ddc86b829d4e4ec32bb35dd
*** Bug 550210 has been marked as a duplicate of this bug. ***