Parcourir la source

Fix ref parsing for refs with no left side.

Julian Berman il y a 8 ans
Parent
commit
987cb6df40
1 fichiers modifiés avec 10 ajouts et 0 suppressions
  1. 10 0
      dulwich/tests/test_objectspec.py

+ 10 - 0
dulwich/tests/test_objectspec.py

@@ -162,6 +162,16 @@ class ParseReftupleTests(TestCase):
         self.assertEqual((b"refs/heads/foo", b"refs/heads/foo", False),
             parse_reftuple(r, r, b"refs/heads/foo"))
 
+    def test_no_left_ref(self):
+        r = {b"refs/heads/foo": "bla"}
+        self.assertEqual((None, b"refs/heads/foo", False),
+            parse_reftuple(r, r, b":refs/heads/foo"))
+
+    def test_no_right_ref(self):
+        r = {b"refs/heads/foo": "bla"}
+        self.assertEqual((b"refs/heads/foo", None, False),
+            parse_reftuple(r, r, b"refs/heads/foo:"))
+
 
 class ParseReftuplesTests(TestCase):