mirror of
https://github.com/restic/restic.git
synced 2025-08-23 09:57:30 +00:00
recover: automatically run repair index before recovering snapshots
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user