Преглед изворни кода

Cope with HEAD not existing.

Jelmer Vernooij пре 16 година
родитељ
комит
ec7fceaa0a
1 измењених фајлова са 5 додато и 2 уклоњено
  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