Browse Source

Allow refs to point at nonexisting things in as_dict.

Jelmer Vernooij 16 years ago
parent
commit
fba50f283d
1 changed files with 7 additions and 4 deletions
  1. 7 4
      dulwich/repo.py

+ 7 - 4
dulwich/repo.py

@@ -117,10 +117,13 @@ class DiskRefsContainer(RefsContainer):
         else:
             keys = self.itersubkeys(base)
         for key in keys:
-            if follow:
-                ret[key] = self.follow(("%s/%s" % (base, key)).strip("/"))
-            else:
-                ret[key] = self[("%s/%s" % (base, key)).strip("/")]
+                if follow:
+                    try:
+                        ret[key] = self.follow(("%s/%s" % (base, key)).strip("/"))
+                    except KeyError:
+                        continue # Unable to resolve
+                else:
+                    ret[key] = self[("%s/%s" % (base, key)).strip("/")]
         return ret
 
     def refpath(self, name):