← Back to team overview

dulwich-users team mailing list archive

[PATCH 05/33] object_store: Fix return type of MemoryObjectStore.get_raw.

 

From: Dave Borowitz <dborowitz@xxxxxxxxxx>

Change-Id: I00481699ef71559b44976a17b564b5cba1f6c3e1
---
 dulwich/object_store.py            |    3 ++-
 dulwich/tests/test_object_store.py |    5 +++++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/dulwich/object_store.py b/dulwich/object_store.py
index e61df1a..9309e50 100644
--- a/dulwich/object_store.py
+++ b/dulwich/object_store.py
@@ -540,7 +540,8 @@ class MemoryObjectStore(BaseObjectStore):
         :param name: sha for the object.
         :return: tuple with numeric type and object contents.
         """
-        return self[name].as_raw_string()
+        obj = self[name]
+        return obj.type_num, obj.as_raw_string()
 
     def __getitem__(self, name):
         return self._data[name]
diff --git a/dulwich/tests/test_object_store.py b/dulwich/tests/test_object_store.py
index 32b405c..314ef3f 100644
--- a/dulwich/tests/test_object_store.py
+++ b/dulwich/tests/test_object_store.py
@@ -178,6 +178,11 @@ class ObjectStoreTests(object):
         for obj in [testobject, tag1, tag2, tag3]:
             self.assertEqual(testobject, self.store.peel_sha(obj.id))
 
+    def test_get_raw(self):
+        self.store.add_object(testobject)
+        self.assertEqual((Blob.type_num, 'yummy data'),
+                         self.store.get_raw(testobject.id))
+
 
 class MemoryObjectStoreTests(ObjectStoreTests, TestCase):
 
-- 
1.7.3.1



References