mirror of
https://github.com/thegeeklab/wp-git-clone.git
synced 2024-11-09 17:50:39 +00:00
31 lines
479 B
Go
31 lines
479 B
Go
package git
|
|
|
|
import (
|
|
"golang.org/x/sys/execabs"
|
|
)
|
|
|
|
// SubmoduleUpdate recursively initializes and updates submodules.
|
|
func SubmoduleUpdate(repo Repository) *execabs.Cmd {
|
|
args := []string{
|
|
"submodule",
|
|
"update",
|
|
"--init",
|
|
"--recursive",
|
|
}
|
|
|
|
if repo.SubmodulePartial {
|
|
args = append(args, "--depth=1", "--recommend-shallow")
|
|
}
|
|
|
|
cmd := execabs.Command(
|
|
gitBin,
|
|
args...,
|
|
)
|
|
|
|
if repo.SubmoduleRemote {
|
|
cmd.Args = append(cmd.Args, "--remote")
|
|
}
|
|
|
|
return cmd
|
|
}
|