Explorar el Código

Cope with HEAD not existing.

Jelmer Vernooij hace 16 años
padre
commit
ec7fceaa0a
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      dulwich/repo.py

+ 5 - 2
dulwich/repo.py

@@ -244,8 +244,11 @@ class Repo(object):
     def get_refs(self):
         """Get dictionary with all refs."""
         ret = {}
-        if self.head():
-            ret['HEAD'] = self.head()
+        try:
+            if self.head():
+                ret['HEAD'] = self.head()
+        except KeyError:
+            pass
         ret.update(self.refs.as_dict())
         ret.update(self.get_packed_refs())
         return ret