Browse Source

Cope with HEAD not existing.

Jelmer Vernooij 16 năm trước cách đây
mục cha
commit
f7e324fe38
1 tập tin đã thay đổi với 5 bổ sung2 xóa
  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