0
0
mirror of https://github.com/thegeeklab/wp-git-action.git synced 2024-11-14 09:00:42 +00:00
wp-git-action/git/init.go

24 lines
384 B
Go
Raw Normal View History

package git
import (
"os"
plugin_exec "github.com/thegeeklab/wp-plugin-go/v3/exec"
)
// Init creates a new Git repository in the specified directory.
func (r *Repository) Init() *plugin_exec.Cmd {
args := []string{
"init",
"-b",
2024-05-06 18:29:57 +00:00
r.Branch,
}
cmd := plugin_exec.Command(gitBin, args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
2024-05-06 18:29:57 +00:00
cmd.Dir = r.WorkDir
2024-05-06 20:43:56 +00:00
return cmd
}