Просмотр исходного кода

Create required refs directories if they don't exist yet.

Jelmer Vernooij 16 лет назад
Родитель
Сommit
f042e6ce51
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      dulwich/repo.py

+ 3 - 0
dulwich/repo.py

@@ -245,6 +245,9 @@ class Repo(object):
 
     def set_ref(self, name, value):
         file = os.path.join(self.controldir(), name)
+        dirpath = os.path.dirname(file)
+        if not os.path.exists(dirpath):
+            os.makedirs(dirpath)
         f = open(file, 'w')
         try:
             f.write(value+"\n")