(gitEnv config.Environment, osEnv config.Environment)
| 97 | } |
| 98 | |
| 99 | func NewCredentialHelperContext(gitEnv config.Environment, osEnv config.Environment) *CredentialHelperContext { |
| 100 | c := &CredentialHelperContext{urlConfig: config.NewURLConfig(gitEnv)} |
| 101 | |
| 102 | c.netrcCredHelper = newNetrcCredentialHelper(osEnv) |
| 103 | |
| 104 | askpass, ok := osEnv.Get("GIT_ASKPASS") |
| 105 | if !ok { |
| 106 | askpass, ok = gitEnv.Get("core.askpass") |
| 107 | } |
| 108 | if !ok { |
| 109 | askpass, _ = osEnv.Get("SSH_ASKPASS") |
| 110 | } |
| 111 | if len(askpass) > 0 { |
| 112 | askpassfile, err := tools.TranslateCygwinPath(askpass) |
| 113 | if err != nil { |
| 114 | tracerx.Printf("Error reading askpass helper %q: %v", askpassfile, err) |
| 115 | } |
| 116 | if len(askpassfile) > 0 { |
| 117 | c.askpassCredHelper = &AskPassCredentialHelper{ |
| 118 | Program: askpassfile, |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | cacheCreds := gitEnv.Bool("lfs.cachecredentials", true) |
| 124 | if cacheCreds { |
| 125 | c.cachingCredHelper = NewCredentialCacher() |
| 126 | } |
| 127 | |
| 128 | c.commandCredHelper = &commandCredentialHelper{ |
| 129 | SkipPrompt: osEnv.Bool("GIT_TERMINAL_PROMPT", false), |
| 130 | } |
| 131 | |
| 132 | return c |
| 133 | } |
| 134 | |
| 135 | func (ctxt *CredentialHelperContext) SetWWWAuthHeaders(headers []string) { |
| 136 | ctxt.wwwAuthHeaders = headers |
no test coverage detected