From 524c820a940be962ab3a787b4b1987daf6e8a292 Mon Sep 17 00:00:00 2001 From: Benoit Gagnon Date: Sat, 28 Sep 2019 11:23:15 -0400 Subject: [PATCH] use regex instead of prefix match to detect github remotes this will allow the optimization to work for both ssh and https --- pkg/git.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/git.go b/pkg/git.go index e0ec7f4..e7ebfb5 100644 --- a/pkg/git.go +++ b/pkg/git.go @@ -162,7 +162,8 @@ func (p *GitPackage) Install(ctx context.Context, name, dir, version string) (st // Optimization for GitHub sources: download a tarball archive of the requested // version instead of cloning the entire repository. Resolves the version to a // commit SHA using the GitHub API. - if strings.HasPrefix(p.Source.Remote, "https://github.com/") { + isGitHubRemote, err := regexp.MatchString(`^(https|ssh)://github\.com/.+$`, p.Source.Remote) + if isGitHubRemote { archiveUrl := fmt.Sprintf("%s/archive/%s.tar.gz", p.Source.Remote, version) archiveFilepath := fmt.Sprintf("%s.tar.gz", tmpDir)