Ensure RevWalks are always reset before calling markStart
Marking new start commits and iterating a RevWalk is only safe if the RevWalk was previously reset. Otherwise its internal graph state may be pointing to some other commit completely unrelated to what the caller is intending to walk. In the case that the RevWalk previously had findMergedInto called on it, this manifests as an UnsupportedOperationException from AlwaysEmptyQueue. Searched for all instances of "markStart" and ensured they were either preceded by reset/resetRetain or the RevWalk was brand new. Change-Id: I1fc34e7b8783921cf0feef1fab9f546700d2fbed
This commit is contained in:
@@ -113,6 +113,7 @@ public class HackPushNegotiateHook implements AdvertiseRefsHook {
|
||||
|
||||
// Scan history until the advertisement is full.
|
||||
RevWalk rw = rp.getRevWalk();
|
||||
rw.reset();
|
||||
try {
|
||||
for (Ref ref : refs) {
|
||||
try {
|
||||
|
||||
@@ -324,6 +324,7 @@ public class SubmoduleOp {
|
||||
msgbuf.append("\n\n");
|
||||
|
||||
try {
|
||||
subOr.rw.resetRetain(subOr.canMergeFlag);
|
||||
subOr.rw.markStart(newCommit);
|
||||
subOr.rw.markUninteresting(subOr.rw.parseCommit(oldId));
|
||||
for (RevCommit c : subOr.rw) {
|
||||
|
||||
@@ -153,6 +153,7 @@ class ChangeNotesParser {
|
||||
// Don't include initial parse in timer, as this might do more I/O to page
|
||||
// in the block containing most commits. Later reads are not guaranteed to
|
||||
// avoid I/O, but often should.
|
||||
walk.reset();
|
||||
walk.markStart(walk.parseCommit(tip));
|
||||
|
||||
try (Timer1.Context timer = metrics.parseLatency.start(CHANGES)) {
|
||||
|
||||
Reference in New Issue
Block a user