Merge pull request #6079 from white-hat/6066-fix-git-protocol
fix protocol not being set when token is read from stdin
This commit is contained in:
commit
49adbe3fe6
2 changed files with 15 additions and 1 deletions
|
|
@ -153,7 +153,9 @@ func loginRun(opts *LoginOptions) error {
|
|||
if err := shared.HasMinimumScopes(httpClient, hostname, opts.Token); err != nil {
|
||||
return fmt.Errorf("error validating token: %w", err)
|
||||
}
|
||||
|
||||
if opts.GitProtocol != "" {
|
||||
cfg.Set(hostname, "git_protocol", opts.GitProtocol)
|
||||
}
|
||||
return cfg.Write()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -232,6 +232,18 @@ func Test_loginRun_nontty(t *testing.T) {
|
|||
},
|
||||
wantHosts: "github.com:\n oauth_token: abc123\n",
|
||||
},
|
||||
{
|
||||
name: "with token and https git-protocol",
|
||||
opts: &LoginOptions{
|
||||
Hostname: "github.com",
|
||||
Token: "abc123",
|
||||
GitProtocol: "https",
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(httpmock.REST("GET", ""), httpmock.ScopesResponder("repo,read:org"))
|
||||
},
|
||||
wantHosts: "github.com:\n oauth_token: abc123\n git_protocol: https\n",
|
||||
},
|
||||
{
|
||||
name: "with token and non-default host",
|
||||
opts: &LoginOptions{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue