20 lines
394 B
Go
20 lines
394 B
Go
package main
|
|
|
|
import (
|
|
git "github.com/go-git/go-git/v5"
|
|
)
|
|
|
|
func initializeRepository(worktree string, cloneurl string) (*git.Repository, error) {
|
|
if cloneurl == "" {
|
|
return git.PlainInit(worktree, false)
|
|
}
|
|
|
|
return git.PlainClone(worktree, false, &git.CloneOptions{
|
|
URL: cloneurl,
|
|
})
|
|
}
|
|
|
|
func loadRepository(worktree string) (*git.Repository, error) {
|
|
return git.PlainOpen(worktree)
|
|
}
|