mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-29 11:16:43 +00:00
prune: fix IndexError
if giving --prefix resulted in an empty archives_checkpoints list, it crashed with an IndexError.
This commit is contained in:
parent
18263f6257
commit
a44e131661
1 changed files with 2 additions and 3 deletions
|
@ -789,9 +789,8 @@ def do_prune(self, args, repository, manifest, key):
|
||||||
is_checkpoint = re.compile(r'\.checkpoint(\.\d+)?$').search
|
is_checkpoint = re.compile(r'\.checkpoint(\.\d+)?$').search
|
||||||
checkpoints = [arch for arch in archives_checkpoints if is_checkpoint(arch.name)]
|
checkpoints = [arch for arch in archives_checkpoints if is_checkpoint(arch.name)]
|
||||||
# keep the latest checkpoint, if there is no later non-checkpoint archive
|
# keep the latest checkpoint, if there is no later non-checkpoint archive
|
||||||
latest_checkpoint = checkpoints[0] if checkpoints else None
|
if archives_checkpoints and checkpoints and archives_checkpoints[0] is checkpoints[0]:
|
||||||
if archives_checkpoints[0] is latest_checkpoint:
|
keep_checkpoints = checkpoints[:1]
|
||||||
keep_checkpoints = [latest_checkpoint, ]
|
|
||||||
else:
|
else:
|
||||||
keep_checkpoints = []
|
keep_checkpoints = []
|
||||||
checkpoints = set(checkpoints)
|
checkpoints = set(checkpoints)
|
||||||
|
|
Loading…
Reference in a new issue