Fix subgroup parsing on subsequent installs (#93)

* Fix subgroup parsing on subsequent installs

* enforce .git as remote suffix

* fix integration tests

* do not modify pointer receiver in getters

* fix merged integration tests
This commit is contained in:
Dominik Süß 2020-05-06 20:40:34 +02:00 committed by GitHub
parent d78a05a86f
commit 50b717beab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 28 deletions

View file

@ -183,7 +183,7 @@ func (p *GitPackage) Install(ctx context.Context, name, dir, version string) (st
defer os.RemoveAll(tmpDir)
// Optimization for GitHub sources: download a tarball archive of the requested
// version instead of cloning the entire repository.
// version instead of cloning the entire
isGitHubRemote, err := regexp.MatchString(`^(https|ssh)://github\.com/.+$`, p.Source.Remote())
if isGitHubRemote {
// Let git ls-remote decide if "version" is a ref or a commit SHA in the unlikely
@ -197,7 +197,7 @@ func (p *GitPackage) Install(ctx context.Context, name, dir, version string) (st
commitSha = version
}
archiveUrl := fmt.Sprintf("%s/archive/%s.tar.gz", p.Source.Remote(), commitSha)
archiveUrl := fmt.Sprintf("%s/archive/%s.tar.gz", strings.TrimSuffix(p.Source.Remote(), ".git"), commitSha)
archiveFilepath := fmt.Sprintf("%s.tar.gz", tmpDir)
defer os.Remove(archiveFilepath)