2023-02-08 09:16:10 +00:00
|
|
|
package git
|
|
|
|
|
|
|
|
import (
|
2024-05-17 19:49:59 +00:00
|
|
|
"os"
|
|
|
|
|
|
|
|
plugin_exec "github.com/thegeeklab/wp-plugin-go/v3/exec"
|
2023-02-08 09:16:10 +00:00
|
|
|
)
|
|
|
|
|
2024-05-05 20:14:55 +00:00
|
|
|
// Init creates a new Git repository in the specified directory.
|
2024-05-17 19:49:59 +00:00
|
|
|
func (r *Repository) Init() *plugin_exec.Cmd {
|
2024-05-06 06:52:25 +00:00
|
|
|
args := []string{
|
2023-02-08 09:16:10 +00:00
|
|
|
"init",
|
2024-05-06 06:52:25 +00:00
|
|
|
"-b",
|
2024-05-06 18:29:57 +00:00
|
|
|
r.Branch,
|
2024-05-06 06:52:25 +00:00
|
|
|
}
|
|
|
|
|
2024-05-17 19:49:59 +00:00
|
|
|
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
|
2023-02-08 09:16:10 +00:00
|
|
|
|
2024-05-06 20:43:56 +00:00
|
|
|
return cmd
|
2023-02-08 09:16:10 +00:00
|
|
|
}
|