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:
20
repo.go
Normal file
20
repo.go
Normal 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")
|
||||
}
|
||||
Reference in New Issue
Block a user