lfsapi: remove *config.Configuration use
This commit is contained in:
parent
ce5f9be2c3
commit
29773dc02c
@ -37,8 +37,8 @@ type credsConfig struct {
|
|||||||
//
|
//
|
||||||
// It returns an error if any configuration was invalid, or otherwise
|
// It returns an error if any configuration was invalid, or otherwise
|
||||||
// un-useable.
|
// un-useable.
|
||||||
func getCredentialHelper(cfg *config.Configuration) (CredentialHelper, error) {
|
func getCredentialHelper(osEnv, gitEnv config.Environment) (CredentialHelper, error) {
|
||||||
ccfg, err := getCredentialConfig(cfg)
|
ccfg, err := getCredentialConfig(osEnv, gitEnv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -71,9 +71,7 @@ func getCredentialHelper(cfg *config.Configuration) (CredentialHelper, error) {
|
|||||||
|
|
||||||
// getCredentialConfig parses a *credsConfig given the OS and Git
|
// getCredentialConfig parses a *credsConfig given the OS and Git
|
||||||
// configurations.
|
// configurations.
|
||||||
func getCredentialConfig(cfg *config.Configuration) (*credsConfig, error) {
|
func getCredentialConfig(o, g config.Environment) (*credsConfig, error) {
|
||||||
g := cfg.Git
|
|
||||||
o := cfg.Os
|
|
||||||
askpass, ok := o.Get("GIT_ASKPASS")
|
askpass, ok := o.Get("GIT_ASKPASS")
|
||||||
if !ok {
|
if !ok {
|
||||||
askpass, ok = g.Get("core.askpass")
|
askpass, ok = g.Get("core.askpass")
|
||||||
|
@ -66,8 +66,7 @@ func NewClient(osEnv Env, gitEnv Env) (*Client, error) {
|
|||||||
return nil, errors.Wrap(err, fmt.Sprintf("bad netrc file %s", netrcfile))
|
return nil, errors.Wrap(err, fmt.Sprintf("bad netrc file %s", netrcfile))
|
||||||
}
|
}
|
||||||
|
|
||||||
creds, err := getCredentialHelper(&config.Configuration{
|
creds, err := getCredentialHelper(osEnv, gitEnv)
|
||||||
Os: osEnv, Git: gitEnv})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "cannot find credential helper(s)")
|
return nil, errors.Wrap(err, "cannot find credential helper(s)")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user