MCPcopy Index your code
hub / github.com/git-bug/git-bug / LoadRepoEnsureUser

Function LoadRepoEnsureUser

commands/execenv/loading.go:43–57  ·  view source on GitHub ↗

LoadRepoEnsureUser is the same as LoadRepo, but also ensure that the user has configured an identity. Use this pre-run function when an error after using the configured user won't do.

(env *Env)

Source from the content-addressed store, hash-verified

41// an identity. Use this pre-run function when an error after using the configured user won't
42// do.
43func LoadRepoEnsureUser(env *Env) func(*cobra.Command, []string) error {
44 return func(cmd *cobra.Command, args []string) error {
45 err := LoadRepo(env)(cmd, args)
46 if err != nil {
47 return err
48 }
49
50 _, err = identity.GetUserIdentity(env.Repo)
51 if err != nil {
52 return err
53 }
54
55 return nil
56 }
57}
58
59// LoadBackend is a pre-run function that load the repository and the Backend for use in a command
60// When using this function you also need to use CloseBackend as a post-run

Callers

nothing calls this directly

Calls 2

GetUserIdentityFunction · 0.92
LoadRepoFunction · 0.85

Tested by

no test coverage detected