浏览代码

server: `_want_satisfied` should not travel all the paths.

Damien Tournoud 10 年之前
父节点
当前提交
d8f62b42db
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      dulwich/server.py

+ 4 - 0
dulwich/server.py

@@ -456,6 +456,7 @@ def _find_shallow(store, heads, depth):
 def _want_satisfied(store, haves, want, earliest):
     o = store[want]
     pending = collections.deque([o])
+    known = set([want])
     while pending:
         commit = pending.popleft()
         if commit.id in haves:
@@ -464,6 +465,9 @@ def _want_satisfied(store, haves, want, earliest):
             # non-commit wants are assumed to be satisfied
             continue
         for parent in commit.parents:
+            if parent in known:
+                continue
+            known.add(parent)
             parent_obj = store[parent]
             # TODO: handle parents with later commit times than children
             if parent_obj.commit_time >= earliest: