Skip to content

Commit

Permalink
always print authtype capability
Browse files Browse the repository at this point in the history
  • Loading branch information
hickford committed Jan 6, 2025
1 parent 52b4382 commit 64517aa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,11 @@ func main() {
if verbose {
fmt.Fprintln(os.Stderr, "token:", token)
}
// "A capability[] directive must precede any value depending on it and these directives should be the first item announced in the protocol." https://git-scm.com/docs/git-credential
fmt.Println("capability[]=authtype")
output := map[string]string{}
hostSupportsBearer := host == "bitbucket.org" || host == "codeberg.org" || host == "gitea.com" || looksLikeGitea || strings.HasSuffix(host, ".googlesource.com")
authtypeCapable := strings.Contains(pairs["capability[]"], "authtype")
if authtypeCapable {
fmt.Println("capability[]=authtype")
}
if bearer && hostSupportsBearer && authtypeCapable {
output["authtype"] = "Bearer"
output["credential"] = token.AccessToken
Expand Down

0 comments on commit 64517aa

Please sign in to comment.