mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
ancestor.deepest: decrement ninteresting correctly (issue3984)
The invariant this code tries to hold is that ninteresting is the number of non-zero elements in the interesting array. interesting[nsp] is incremented at the same time as interesting[sp] is decremented. So if interesting[nsp] was previously 0, ninteresting shouldn't be decremented.
This commit is contained in:
parent
2267993ebc
commit
ec2b8c873f
@ -1362,10 +1362,10 @@ static PyObject *find_deepest(indexObject *self, PyObject *revs)
|
||||
if (nsp == sp)
|
||||
continue;
|
||||
seen[p] = nsp;
|
||||
interesting[nsp] += 1;
|
||||
interesting[sp] -= 1;
|
||||
if (interesting[sp] == 0)
|
||||
if (interesting[sp] == 0 && interesting[nsp] > 0)
|
||||
ninteresting -= 1;
|
||||
interesting[nsp] += 1;
|
||||
}
|
||||
}
|
||||
interesting[sv] -= 1;
|
||||
|
Loading…
Reference in New Issue
Block a user