mirror of
https://github.com/restic/restic.git
synced 2024-12-23 08:16:36 +00:00
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
1 changed files with 9 additions and 9 deletions
|
@ -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 a new issue