1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-24 16:55:36 +00:00

Fix file cache save bug

This commit is contained in:
Jonas Borgström 2014-06-03 23:10:52 +02:00
parent 243481f6da
commit df85e72d3c

View file

@ -103,11 +103,12 @@ def commit(self):
return
if self.files is not None:
with open(os.path.join(self.path, 'files'), 'wb') as fd:
for item in self.files.items():
for path_hash, item in self.files.items():
# Discard cached files with the newest mtime to avoid
# issues with filesystem snapshots and mtime precision
if item[1][0] < 10 and item[1][3] < self._newest_mtime:
msgpack.pack(item, fd)
item = msgpack.unpackb(item)
if item[0] < 10 and bigint_to_int(item[3]) < self._newest_mtime:
msgpack.pack((path_hash, item), fd)
self.config.set('cache', 'manifest', hexlify(self.manifest.id).decode('ascii'))
self.config.set('cache', 'timestamp', self.manifest.timestamp)
with open(os.path.join(self.path, 'config'), 'w') as fd: