LoginRefreshable stores a refreshable credential for the user, sets the git protocol, and activates the user. It mirrors Login: secure storage is preferred and the insecure configuration is used as a fallback, reported via the returned bool. Any non-expiring credential for the user is removed so it
(hostname, username string, credential gh.Credential, gitProtocol string, secureStorage bool)
| 143 | // runs under the cross-process refresh lock and reloads the configuration first, so it cannot interleave with a |
| 144 | // concurrent configuration read-modify-write in another gh process. |
| 145 | func (c *AuthConfig) LoginRefreshable(hostname, username string, credential gh.Credential, gitProtocol string, secureStorage bool) (bool, error) { |
| 146 | var insecureStorageUsed bool |
| 147 | err := c.withFreshConfigForRefresh(func(lockErr error) error { |
| 148 | var err error |
| 149 | insecureStorageUsed, err = c.loginRefreshable(hostname, username, credential, gitProtocol, secureStorage) |
| 150 | return err |
| 151 | }) |
| 152 | return insecureStorageUsed, err |
| 153 | } |
| 154 | |
| 155 | func (c *AuthConfig) loginRefreshable(hostname, username string, credential gh.Credential, gitProtocol string, secureStorage bool) (bool, error) { |
| 156 | if hostname == "" || username == "" { |
nothing calls this directly
no test coverage detected