From 54e177d46da4fe2e9c14c2b95aedefbe33951e19 Mon Sep 17 00:00:00 2001 From: Seunghyun Hwang Date: Fri, 4 Oct 2024 21:13:58 +0900 Subject: [PATCH] fix bootstrap for Azure DevOps (#594) Signed-off-by: Seunghyun Hwang --- pkg/git/provider_ado.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/git/provider_ado.go b/pkg/git/provider_ado.go index 75af0bd4..5ef8a318 100644 --- a/pkg/git/provider_ado.go +++ b/pkg/git/provider_ado.go @@ -2,6 +2,7 @@ package git import ( "context" + "crypto/tls" "fmt" "net/url" "strings" @@ -52,7 +53,9 @@ func newAdo(opts *ProviderOptions) (Provider, error) { return nil, err } - connection.TlsConfig.RootCAs = rootCAs + connection.TlsConfig = &tls.Config{ + RootCAs: rootCAs, + } ctx, cancel := context.WithTimeout(context.Background(), timeoutTime) defer cancel() // FYI: ado also has a "core" client that can be used to update project, teams, and other ADO constructs @@ -97,7 +100,10 @@ func (g *adoGit) GetDefaultBranch(ctx context.Context, orgRepo string) (string, if err != nil { return "", err } - + if r.DefaultBranch == nil { + // Repo is empty. + return "main", nil + } return *r.DefaultBranch, nil }