← Back to team overview

dulwich-users team mailing list archive

[PATCH 05/13] object_store: Don't send a pack with duplicates of the same object.

 

From: Dave Borowitz <dborowitz@xxxxxxxxxx>

Change-Id: I60cff6453dcd40fefcda8c7048befd545451d712
---
 NEWS                    |    2 ++
 dulwich/object_store.py |    9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index d5441c4..9d5cf09 100644
--- a/NEWS
+++ b/NEWS
@@ -47,6 +47,8 @@
 
   * Teach ReceivePackHandler how to read empty packs. (Dave Borowitz)
 
+  * Don't send a pack with duplicates of the same object. (Dave Borowitz)
+
  API CHANGES
 
   * write_pack no longer takes the num_objects argument and requires an object
diff --git a/dulwich/object_store.py b/dulwich/object_store.py
index 511473f..36b5498 100644
--- a/dulwich/object_store.py
+++ b/dulwich/object_store.py
@@ -731,9 +731,12 @@ class MissingObjectFinder(object):
         self.add_todo([(tag.object[1], None, False)])
 
     def next(self):
-        if not self.objects_to_send:
-            return None
-        (sha, name, leaf) = self.objects_to_send.pop()
+        while True:
+            if not self.objects_to_send:
+                return None
+            (sha, name, leaf) = self.objects_to_send.pop()
+            if sha not in self.sha_done:
+                break
         if not leaf:
             o = self.object_store[sha]
             if isinstance(o, Commit):
-- 
1.7.3.1



References