Don't merge directory state tree entries that have the same ID. When merged, two entries should always take the smaller ID.

This commit is contained in:
A.J. Beamon 2018-05-23 12:20:05 -07:00
parent 1a39cd4a81
commit f52da485a9
1 changed files with 3 additions and 2 deletions

View File

@ -99,7 +99,7 @@ class DirectoryStateTreeNode:
return subdir._add_child_impl(subpath[1:], child) return subdir._add_child_impl(subpath[1:], child)
def _merge(self, other): def _merge(self, other):
if self == other: if self.dir_id == other.dir_id:
return return
self.is_directory = self.is_directory and other.is_directory self.is_directory = self.is_directory and other.is_directory
@ -114,7 +114,8 @@ class DirectoryStateTreeNode:
other.has_known_prefix = self.has_known_prefix other.has_known_prefix = self.has_known_prefix
other.deleted = self.deleted other.deleted = self.deleted
other.is_partition = self.is_partition other.is_partition = self.is_partition
other.dir_id = self.dir_id other.dir_id = min(other.dir_id, self.dir_id)
self.dir_id = other.dir_id
other_children = other.children.copy() other_children = other.children.copy()
for c in other_children: for c in other_children: