Split git clone/pull and merge function

This commit is contained in:
morganamilo 2018-06-10 00:42:58 +01:00
parent c3a94edd20
commit 5775e3c0b7
No known key found for this signature in database
GPG Key ID: 6FE9E7996B0B082E
2 changed files with 12 additions and 2 deletions

View File

@ -71,7 +71,11 @@ func gitDownload(url string, path string, name string) error {
return fmt.Errorf("error fetching %s", name)
}
err = passToGit(filepath.Join(path, name), "reset", "--hard", "HEAD")
return nil
}
func gitMerge(url string, path string, name string) error {
err := passToGit(filepath.Join(path, name), "reset", "--hard", "HEAD")
if err != nil {
return fmt.Errorf("error resetting %s", name)
}

View File

@ -636,10 +636,16 @@ func downloadPkgBuilds(pkgs []*rpc.Pkg, targets stringSet, bases map[string][]*r
var err error
if shouldUseGit(filepath.Join(config.BuildDir, pkg.PackageBase)) {
err = gitDownload(baseURL+"/"+pkg.PackageBase+".git", config.BuildDir, pkg.PackageBase)
err = gitDownload(baseURL + "/" + pkg.PackageBase + ".git", config.BuildDir, pkg.PackageBase)
if err != nil {
return hashes, err
}
err = gitMerge(baseURL + "/" + pkg.PackageBase + ".git", config.BuildDir, pkg.PackageBase)
if err != nil {
return hashes, err
}
} else {
err = downloadAndUnpack(baseURL+pkg.URLPath, config.BuildDir)
}