mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2025-12-12 08:00:05 +01:00
use regex instead of prefix match to detect github remotes
this will allow the optimization to work for both ssh and https
This commit is contained in:
parent
76d85b1f49
commit
524c820a94
1 changed files with 2 additions and 1 deletions
|
|
@ -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
|
// Optimization for GitHub sources: download a tarball archive of the requested
|
||||||
// version instead of cloning the entire repository. Resolves the version to a
|
// version instead of cloning the entire repository. Resolves the version to a
|
||||||
// commit SHA using the GitHub API.
|
// 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)
|
archiveUrl := fmt.Sprintf("%s/archive/%s.tar.gz", p.Source.Remote, version)
|
||||||
archiveFilepath := fmt.Sprintf("%s.tar.gz", tmpDir)
|
archiveFilepath := fmt.Sprintf("%s.tar.gz", tmpDir)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue