fix an infinite loop in the topo traversal algorithm
When skipping null-merges, do not go back to the first parent node if we have already processed it. Fix a similar potential issue when handling parent nodes during regular processing. Change-Id: I10e531cdf3b203ca2e9249d89a37b61f79091311 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
3b2b36fede
commit
a42a617350
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Remove an infinite loop in the traversal algorithm caused by some
|
||||
null-merge skip situations.
|
|
@ -729,9 +729,11 @@ class Scanner(object):
|
|||
# and we can continue past the merge.
|
||||
emitted.add(sha)
|
||||
# Now set up the first parent so it is processed
|
||||
# later.
|
||||
# later, as long as we haven't already processed
|
||||
# it.
|
||||
first_parent = entry.commit.parents[0]
|
||||
if first_parent not in todo:
|
||||
if (first_parent not in todo and
|
||||
first_parent not in emitted):
|
||||
todo.appendleft(first_parent)
|
||||
continue
|
||||
|
||||
|
@ -771,7 +773,7 @@ class Scanner(object):
|
|||
# to grow very large, but it's not clear the output
|
||||
# will be produced in the right order.
|
||||
for p in entry.commit.parents:
|
||||
if p not in todo:
|
||||
if p not in todo and p not in emitted:
|
||||
todo.appendleft(p)
|
||||
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue