mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-26 09:47:58 +00:00
Rather than error beginning a txn, create an empty files cache if it didn't exist before
This commit is contained in:
parent
a0322d241d
commit
dbbd3f1b63
1 changed files with 5 additions and 1 deletions
|
@ -567,7 +567,11 @@ def begin_txn(self):
|
||||||
pi.output('Initializing cache transaction: Reading chunks')
|
pi.output('Initializing cache transaction: Reading chunks')
|
||||||
shutil.copy(os.path.join(self.path, 'chunks'), txn_dir)
|
shutil.copy(os.path.join(self.path, 'chunks'), txn_dir)
|
||||||
pi.output('Initializing cache transaction: Reading files')
|
pi.output('Initializing cache transaction: Reading files')
|
||||||
|
try:
|
||||||
shutil.copy(os.path.join(self.path, files_cache_name()), txn_dir)
|
shutil.copy(os.path.join(self.path, files_cache_name()), txn_dir)
|
||||||
|
except FileNotFoundError:
|
||||||
|
with SaveFile(os.path.join(txn_dir, files_cache_name()), binary=True):
|
||||||
|
pass # empty file
|
||||||
os.rename(os.path.join(self.path, 'txn.tmp'),
|
os.rename(os.path.join(self.path, 'txn.tmp'),
|
||||||
os.path.join(self.path, 'txn.active'))
|
os.path.join(self.path, 'txn.active'))
|
||||||
self.txn_active = True
|
self.txn_active = True
|
||||||
|
|
Loading…
Reference in a new issue