From 255d80eb037bb2fb6131d4b9c86a80cd268ff55d Mon Sep 17 00:00:00 2001 From: Mars Liu Date: Wed, 24 Nov 2021 02:59:50 +0800 Subject: [PATCH] fixed odd orders --- src/tree.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tree.py b/src/tree.py index 9dc5fe2..bb8e879 100644 --- a/src/tree.py +++ b/src/tree.py @@ -247,8 +247,12 @@ class TreeWalker: return config def ensure_node_id(self, config): - if "node_id" not in config: - config["node_id"] = self.gen_node_id() + if "node_id" not in config or \ + not config["node_id"].startswith(f"{self.tree}-") or \ + config["node_id"] in id_set: + new_id = self.gen_node_id() + id_set.add(new_id) + config["node_id"] = new_id return True, config else: return False, config -- GitLab