6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-09 12:39:18 +00:00

Add CloneRepo function and unit tests for cloned repos status

This commit is contained in:
Grzegorz Dlugoszewski
2020-05-19 14:12:38 +02:00
parent a0f09ef74d
commit dfc8437408
5 changed files with 130 additions and 32 deletions

20
repo.go Normal file
View File

@@ -0,0 +1,20 @@
package main
import (
"github.com/pkg/errors"
git "github.com/libgit2/git2go/v30"
)
func CloneRepo(url string, path string) (*git.Repository, error) {
options := &git.CloneOptions{
CheckoutOpts: nil,
FetchOptions: nil,
Bare: false,
CheckoutBranch: "",
RemoteCreateCallback: nil,
}
repo, err := git.Clone(url, path, options)
return repo, errors.Wrap(err, "Failed cloning repo")
}