Skip to content

Commit

Permalink
Add transport workaround to git_util if azure dev ops is used
Browse files Browse the repository at this point in the history
More info in go-git/go-git#613 .
  • Loading branch information
stuggi committed Aug 4, 2023
1 parent 906f3e9 commit f591e63
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/openstackconfigversion/git_util.go
Expand Up @@ -30,6 +30,7 @@ import (
git "github.com/go-git/go-git/v5"
config "github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing/format/diff"
"github.com/go-git/go-git/v5/plumbing/protocol/packp/capability"
"github.com/go-git/go-git/v5/plumbing/transport"
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
"github.com/go-git/go-git/v5/storage/memory"
Expand Down Expand Up @@ -141,6 +142,15 @@ func SyncGit(
return nil, err
}

// azure is not compatible to go-git, https://github.com/go-git/go-git/pull/613
// if host contains azure lets set capability.ThinPack
if strings.Contains(strings.ToLower(gitEndpoint.Host), "azure") {
log.Info(fmt.Sprintf("azure in git host, expecting Azure DevOps and set capability.ThinPack transport capability."))

Check failure on line 148 in pkg/openstackconfigversion/git_util.go

View workflow job for this annotation

GitHub Actions / github (golangci)

S1039: unnecessary use of fmt.Sprintf (gosimple)
transport.UnsupportedCapabilities = []capability.Capability{
capability.ThinPack,
}
}

publicKeys, err := ssh.NewPublicKeys(gitEndpoint.User, pkey, "")
publicKeys.HostKeyCallback = crypto_ssh.InsecureIgnoreHostKey()
if err != nil {
Expand Down

0 comments on commit f591e63

Please sign in to comment.