Treat an empty password as a fatal error for repository init.

This commit is contained in:
Denny Page authored and Michael Eischer committed 2021-02-28 00:40:00 +01:00
1 parent bb53fcfc0d
commit 0f41e99ea7
3 files changed
+14 -6

No files matched your search

+5 -5
View File
@@ -53,11 +53,6 @@ func runInit(opts InitOptions, gopts GlobalOptions, args []string) error {
return err
}
be, err := create(repo, gopts.extended)
if err != nil {
return errors.Fatalf("create repository at %s failed: %v\n", location.StripPassword(gopts.Repo), err)
}
gopts.password, err = ReadPasswordTwice(gopts,
"enter password for new repository: ",
"enter password again: ")
@@ -65,6 +60,11 @@ func runInit(opts InitOptions, gopts GlobalOptions, args []string) error {
return err
}
be, err := create(repo, gopts.extended)
if err != nil {
return errors.Fatalf("create repository at %s failed: %v\n", location.StripPassword(gopts.Repo), err)
}
s := repository.New(be)
err = s.Init(gopts.ctx, gopts.password, chunkerPolynomial)