mirror of
https://github.com/restic/restic.git
synced 2026-02-03 20:39:52 -05:00
recover: automatically run repair index before recovering snapshots
This commit is contained in:
parent
0b6c355678
commit
2409078d55
1 changed files with 7 additions and 1 deletions
|
|
@ -49,7 +49,7 @@ func runRecover(ctx context.Context, gopts GlobalOptions, term *termstatus.Termi
|
|||
return err
|
||||
}
|
||||
|
||||
ctx, repo, unlock, err := openWithAppendLock(ctx, gopts, false)
|
||||
ctx, repo, unlock, err := openWithExclusiveLock(ctx, gopts, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -62,6 +62,12 @@ func runRecover(ctx context.Context, gopts GlobalOptions, term *termstatus.Termi
|
|||
return err
|
||||
}
|
||||
|
||||
printer.P("ensuring index is complete\n")
|
||||
err = repository.RepairIndex(ctx, repo, repository.RepairIndexOptions{}, printer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printer.P("load index files\n")
|
||||
bar := newIndexTerminalProgress(gopts.Quiet, gopts.JSON, term)
|
||||
if err = repo.LoadIndex(ctx, bar); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue