Set previous_location on load instead of save

This caused a really stupid bug with borg config --cache, see
https://github.com/borgbackup/borg/issues/3304#issuecomment-371896766
This commit is contained in:
Milkey Mouse 2018-03-09 10:18:25 -08:00
parent b812472f36
commit 4098f0f05c
No known key found for this signature in database
GPG Key ID: C6EF5A02F5647987
1 changed files with 1 additions and 1 deletions

View File

@ -290,6 +290,7 @@ class CacheConfig:
self.previous_location = recanonicalize_relative_location(previous_location, self.repository)
else:
self.previous_location = None
self._config.set('cache', 'previous_location', self.repository._location.canonical_path())
def save(self, manifest=None, key=None):
if manifest:
@ -304,7 +305,6 @@ class CacheConfig:
self._config.set('integrity', 'manifest', manifest.id_str)
if key:
self._config.set('cache', 'key_type', str(key.TYPE))
self._config.set('cache', 'previous_location', self.repository._location.canonical_path())
with SaveFile(self.config_path) as fd:
self._config.write(fd)