فهرست منبع

Merge pull request #1199 from verygreen/bug1195

Ignore empty index file.
TW 9 سال پیش
والد
کامیت
c2eae540c3
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      borg/repository.py

+ 3 - 1
borg/repository.py

@@ -129,7 +129,9 @@ class Repository:
         shutil.rmtree(self.path)
         shutil.rmtree(self.path)
 
 
     def get_index_transaction_id(self):
     def get_index_transaction_id(self):
-        indices = sorted((int(name[6:]) for name in os.listdir(self.path) if name.startswith('index.') and name[6:].isdigit()))
+        indices = sorted(int(fn[6:])
+                         for fn in os.listdir(self.path)
+                         if fn.startswith('index.') and fn[6:].isdigit() and os.stat(os.path.join(self.path, fn)).st_size != 0)
         if indices:
         if indices:
             return indices[-1]
             return indices[-1]
         else:
         else: