|
@@ -299,6 +299,25 @@ class PackBasedObjectStoreTests(ObjectStoreTests):
|
|
|
self.assertEqual(1, len(self.store.packs))
|
|
|
self.assertEqual(0, self.store.pack_loose_objects())
|
|
|
|
|
|
+ def test_repack_existing(self):
|
|
|
+ b1 = make_object(Blob, data=b"yummy data")
|
|
|
+ self.store.add_object(b1)
|
|
|
+ b2 = make_object(Blob, data=b"more yummy data")
|
|
|
+ self.store.add_object(b2)
|
|
|
+ self.store.add_objects([(b1, None), (b2, None)])
|
|
|
+ self.store.add_objects([(b2, None)])
|
|
|
+ self.assertEqual({b1.id, b2.id}, set(self.store))
|
|
|
+ self.assertEqual(2, len(self.store.packs))
|
|
|
+ self.assertEqual(2, self.store.repack())
|
|
|
+ self.assertEqual(1, len(self.store.packs))
|
|
|
+ self.assertEqual(0, self.store.pack_loose_objects())
|
|
|
+
|
|
|
+ self.assertEqual({b1.id, b2.id}, set(self.store))
|
|
|
+ self.assertEqual(1, len(self.store.packs))
|
|
|
+ self.assertEqual(2, self.store.repack())
|
|
|
+ self.assertEqual(1, len(self.store.packs))
|
|
|
+ self.assertEqual(0, self.store.pack_loose_objects())
|
|
|
+
|
|
|
|
|
|
class DiskObjectStoreTests(PackBasedObjectStoreTests, TestCase):
|
|
|
|