radicle: fix diverging quorum
When calculating a quorum there was a case where two heads that were equal would result in double-counting, allowing the quorum to pass a threshold higher than the expected votes.
To prevent this, each head is immediately counted as a direct vote. Then, when comparing the head to the rest of the set, if they are equal that iteration would be skipped. This is because the merge base of two equal commits is that commit, resulting in the double-counting.
Note that the skip can also skip the current head, so i + 1 is used.
1 file changed
+22
-3
589c3756
→
3260046c
modified radicle/src/storage/git.rs
@@ -996,11 +996,18 @@ pub fn quorum(
|
|
|
|
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
| - | |
| - | |
|
|
|
|
|
@@ -1157,6 +1164,7 @@ mod tests {
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -1165,6 +1173,7 @@ mod tests {
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -1216,6 +1225,16 @@ mod tests {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|