Преглед на файлове

Allow refs to point at nonexisting things in as_dict.

Jelmer Vernooij преди 16 години
родител
ревизия
fba50f283d
променени са 1 файла, в които са добавени 7 реда и са изтрити 4 реда
  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):