From cbe4b20243e33ba70612645c2a1a1fa10ec953fc Mon Sep 17 00:00:00 2001 From: Tom Kennedy <10608054+tomkennedy513@users.noreply.github.com> Date: Mon, 2 Oct 2023 21:07:28 -0400 Subject: [PATCH] [0.12.x] Fix azure devops (#1338) Fix cloning with Azure DevOps Git - remove multi_ack and multi_ack_detailed from unsupported capabilities - see https://github.com/go-git/go-git/blob/52c2972976737a00fce91d7deb1278a6a460cae6/_examples/azure_devops/main.go\#L21-L36 for more info - we should be able to remove this once go-git implements full support for v2 git with multi_ack Signed-off-by: Tom Kennedy --- pkg/git/fetch.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/git/fetch.go b/pkg/git/fetch.go index 999ca6568..8725045d3 100644 --- a/pkg/git/fetch.go +++ b/pkg/git/fetch.go @@ -9,6 +9,7 @@ import ( gogit "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/plumbing" + "github.com/go-git/go-git/v5/plumbing/protocol/packp/capability" "github.com/go-git/go-git/v5/plumbing/transport" "github.com/pkg/errors" ) @@ -18,6 +19,13 @@ type Fetcher struct { Keychain GitKeychain } +func init() { + //remove multi_ack and multi_ack_detailed from unsupported capabilities to enable Azure DevOps git support + transport.UnsupportedCapabilities = []capability.Capability{ + capability.ThinPack, + } +} + func (f Fetcher) Fetch(dir, gitURL, gitRevision, metadataDir string) error { f.Logger.Printf("Cloning %q @ %q...", gitURL, gitRevision) auth, err := f.Keychain.Resolve(gitURL)