mirror of
https://github.com/Jguer/yay.git
synced 2025-11-29 00:05:47 -05:00
Split git clone/pull and merge function
This commit is contained in:
parent
c3a94edd20
commit
5775e3c0b7
@ -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)
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user