1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-22 15:57:07 +00:00

Fix repository not being printed when using repository file

When using `RESTIC_REPOSITORY_FILE` in combination with `restic init`,
the repository is missing in the output:
```
$ restic init
created restic repository 3c872be20f at
[...]
```
This is due to the code using `gopts.Repo`, which is empty in this case.
This commit is contained in:
Michael Kuhn 2023-11-20 22:56:27 +01:00 committed by Michael Eischer
parent da4e3edbbc
commit fd2fb233aa

View file

@ -75,7 +75,7 @@ func runInit(ctx context.Context, opts InitOptions, gopts GlobalOptions, args []
return err return err
} }
repo, err := ReadRepo(gopts) gopts.Repo, err = ReadRepo(gopts)
if err != nil { if err != nil {
return err return err
} }
@ -87,7 +87,7 @@ func runInit(ctx context.Context, opts InitOptions, gopts GlobalOptions, args []
return err return err
} }
be, err := create(ctx, repo, gopts, gopts.extended) be, err := create(ctx, gopts.Repo, gopts, gopts.extended)
if err != nil { if err != nil {
return errors.Fatalf("create repository at %s failed: %v\n", location.StripPassword(gopts.backends, gopts.Repo), err) return errors.Fatalf("create repository at %s failed: %v\n", location.StripPassword(gopts.backends, gopts.Repo), err)
} }