mirror of
https://github.com/thegeeklab/wp-git-clone.git
synced 2024-11-22 10:20:38 +00:00
29 lines
513 B
Go
29 lines
513 B
Go
package git
|
|
|
|
import (
|
|
"github.com/thegeeklab/wp-plugin-go/v2/types"
|
|
"golang.org/x/sys/execabs"
|
|
)
|
|
|
|
// SubmoduleUpdate recursively initializes and updates submodules.
|
|
func (r *Repository) SubmoduleUpdate() *types.Cmd {
|
|
args := []string{
|
|
"submodule",
|
|
"update",
|
|
"--init",
|
|
"--recursive",
|
|
}
|
|
|
|
if r.SubmodulePartial {
|
|
args = append(args, "--depth=1", "--recommend-shallow")
|
|
}
|
|
|
|
if r.SubmoduleRemote {
|
|
args = append(args, "--remote")
|
|
}
|
|
|
|
return &types.Cmd{
|
|
Cmd: execabs.Command(gitBin, args...),
|
|
}
|
|
}
|