Merge pull request #3173 from MichaelEischer/unify-index-loading

Unify index loading
This commit is contained in:
Alexander Neumann
2021-01-28 13:50:42 +01:00
committed by GitHub
7 changed files with 185 additions and 181 deletions
+1 -3
View File
@@ -110,10 +110,8 @@ func printPacks(ctx context.Context, repo *repository.Repository, wr io.Writer)
}
func dumpIndexes(ctx context.Context, repo restic.Repository, wr io.Writer) error {
return repo.List(ctx, restic.IndexFile, func(id restic.ID, size int64) error {
return repository.ForAllIndexes(ctx, repo, func(id restic.ID, idx *repository.Index, oldFormat bool, err error) error {
Printf("index_id: %v\n", id)
idx, err := repository.LoadIndex(ctx, repo, id)
if err != nil {
return err
}
+1 -3
View File
@@ -60,8 +60,7 @@ func runList(cmd *cobra.Command, opts GlobalOptions, args []string) error {
case "locks":
t = restic.LockFile
case "blobs":
return repo.List(opts.ctx, restic.IndexFile, func(id restic.ID, size int64) error {
idx, err := repository.LoadIndex(opts.ctx, repo, id)
return repository.ForAllIndexes(opts.ctx, repo, func(id restic.ID, idx *repository.Index, oldFormat bool, err error) error {
if err != nil {
return err
}
@@ -70,7 +69,6 @@ func runList(cmd *cobra.Command, opts GlobalOptions, args []string) error {
}
return nil
})
default:
return errors.Fatal("invalid type")
}