mirror of https://github.com/restic/restic.git
ls: Check dirs before opening the repository
Users get feedback instantly, and before any expensive network calls have been made.
This commit is contained in:
parent
11ce572894
commit
0deb4e5994
|
@ -65,15 +65,6 @@ func runLs(opts LsOptions, gopts GlobalOptions, args []string) error {
|
|||
return errors.Fatal("Invalid arguments, either give one or more snapshot IDs or set filters.")
|
||||
}
|
||||
|
||||
repo, err := OpenRepository(gopts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = repo.LoadIndex(gopts.ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// extract any specific directories to walk
|
||||
var dirs []string
|
||||
if len(args) > 1 {
|
||||
|
@ -85,6 +76,15 @@ func runLs(opts LsOptions, gopts GlobalOptions, args []string) error {
|
|||
}
|
||||
}
|
||||
|
||||
repo, err := OpenRepository(gopts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = repo.LoadIndex(gopts.ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(gopts.ctx)
|
||||
defer cancel()
|
||||
for sn := range FindFilteredSnapshots(ctx, repo, opts.Host, opts.Tags, opts.Paths, args[:1]) {
|
||||
|
|
Loading…
Reference in New Issue