mirror of https://github.com/borgbackup/borg.git
fix cascading failure with the index conversion code
this resolves bug #something where the index file could not be converted, completely breaking conversion. it seems that, during some refactoring, the index conversion code was completely dropped. this was missed by the unit tests because the repo can still be opened by the constructor even though the index is invalid, so tests need improvements there.
This commit is contained in:
parent
0e9c524266
commit
c4599d8ea4
|
@ -139,12 +139,14 @@ class AtticRepositoryUpgrader(Repository):
|
|||
`Cache.open()`, edit in place and then `Cache.close()` to
|
||||
make sure we have locking right
|
||||
"""
|
||||
caches = []
|
||||
transaction_id = self.get_index_transaction_id()
|
||||
if transaction_id is None:
|
||||
logger.warning('no index file found for repository %s' % self.path)
|
||||
else:
|
||||
caches += [os.path.join(self.path, 'index.%d' % transaction_id).encode('utf-8')]
|
||||
cache = os.path.join(self.path, 'index.%d' % transaction_id).encode('utf-8')
|
||||
logger.info("converting index cache %s" % cache)
|
||||
if not dryrun:
|
||||
AtticRepositoryUpgrader.header_replace(cache, b'ATTICIDX', b'BORG_IDX')
|
||||
|
||||
# copy of attic's get_cache_dir()
|
||||
attic_cache_dir = os.environ.get('ATTIC_CACHE_DIR',
|
||||
|
|
Loading…
Reference in New Issue