1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-28 19:01:58 +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:
Thomas Waldmann 2016-05-07 21:03:31 +02:00
parent 18263f6257
commit a44e131661

View file

@ -789,9 +789,8 @@ def do_prune(self, args, repository, manifest, key):
is_checkpoint = re.compile(r'\.checkpoint(\.\d+)?$').search
checkpoints = [arch for arch in archives_checkpoints if is_checkpoint(arch.name)]
# keep the latest checkpoint, if there is no later non-checkpoint archive
latest_checkpoint = checkpoints[0] if checkpoints else None
if archives_checkpoints[0] is latest_checkpoint:
keep_checkpoints = [latest_checkpoint, ]
if archives_checkpoints and checkpoints and archives_checkpoints[0] is checkpoints[0]:
keep_checkpoints = checkpoints[:1]
else:
keep_checkpoints = []
checkpoints = set(checkpoints)