소스 검색

Cope with HEAD not existing.

Jelmer Vernooij 16 년 전
부모
커밋
f7e324fe38
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