Copied and pasted directly from the trunk branch before doing any work on login, plus the addition of AuthConfig as the first arg since it is a method receiver in the real implementation.
(c *AuthConfig, hostname, username, token, gitProtocol string, secureStorage bool)
| 927 | // login, plus the addition of AuthConfig as the first arg since it is a method |
| 928 | // receiver in the real implementation. |
| 929 | func preMigrationLogin(c *AuthConfig, hostname, username, token, gitProtocol string, secureStorage bool) (bool, error) { |
| 930 | var setErr error |
| 931 | if secureStorage { |
| 932 | if setErr = keyring.Set(keyringServiceName(hostname), "", token); setErr == nil { |
| 933 | // Clean up the previous oauth_token from the config file. |
| 934 | _ = c.cfg.Remove([]string{hostsKey, hostname, oauthTokenKey}) |
| 935 | } |
| 936 | } |
| 937 | insecureStorageUsed := false |
| 938 | if !secureStorage || setErr != nil { |
| 939 | c.cfg.Set([]string{hostsKey, hostname, oauthTokenKey}, token) |
| 940 | insecureStorageUsed = true |
| 941 | } |
| 942 | |
| 943 | c.cfg.Set([]string{hostsKey, hostname, userKey}, username) |
| 944 | |
| 945 | if gitProtocol != "" { |
| 946 | c.cfg.Set([]string{hostsKey, hostname, gitProtocolKey}, gitProtocol) |
| 947 | } |
| 948 | return insecureStorageUsed, ghConfig.Write(c.cfg) |
| 949 | } |
no test coverage detected