Browse Source

Special case ZERO_SHA.

Jelmer Vernooij 6 years ago
parent
commit
de80116853
2 changed files with 3 additions and 1 deletions
  1. 1 1
      dulwich/contrib/test_release_robot.py
  2. 2 0
      dulwich/object_store.py

+ 1 - 1
dulwich/contrib/test_release_robot.py

@@ -62,7 +62,7 @@ class GetRecentTagsTest(unittest.TestCase):
     committer = b"Mark Mikofski <mark.mikofski@sunpowercorp.com>"
     test_tags = [b'v0.1a', b'v0.1']
     tag_test_data = {
-        test_tags[0]: [1484788003, b'0' * 40, None],
+        test_tags[0]: [1484788003, b'3' * 40, None],
         test_tags[1]: [1484788314, b'1' * 40, (1484788401, b'2' * 40)]
     }
 

+ 2 - 0
dulwich/object_store.py

@@ -448,6 +448,8 @@ class PackBasedObjectStore(BaseObjectStore):
         :param name: sha for the object.
         :return: tuple with numeric type and object contents.
         """
+        if name == ZERO_SHA:
+            raise KeyError(name)
         if len(name) == 40:
             sha = hex_to_sha(name)
             hexsha = name