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

23 lines
359 B
Go
Raw Normal View History

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