commands/clone,git: support '--shallow-submodules'

This commit is contained in:
Taylor Blau 2017-05-22 09:25:46 -06:00
parent aabbc22737
commit d805f0b7db
2 changed files with 6 additions and 0 deletions

@ -151,6 +151,7 @@ func init() {
cmd.Flags().BoolVarP(&cloneFlags.Ipv6, "ipv6", "", false, "See 'git clone --help'")
cmd.Flags().StringVarP(&cloneFlags.ShallowSince, "shallow-since", "", "", "See 'git clone --help'")
cmd.Flags().StringVarP(&cloneFlags.ShallowExclude, "shallow-exclude", "", "", "See 'git clone --help'")
cmd.Flags().BoolVarP(&cloneFlags.ShallowSubmodules, "shallow-submodules", "", false, "See 'git clone --help'")
cmd.Flags().StringVarP(&includeArg, "include", "I", "", "Include a list of paths")
cmd.Flags().StringVarP(&excludeArg, "exclude", "X", "", "Exclude a list of paths")

@ -804,6 +804,8 @@ type CloneFlags struct {
ShallowSince string
// --shallow-since <date>
ShallowExclude string
// --shallow-submodules
ShallowSubmodules bool
}
// CloneWithoutFilters clones a git repo but without the smudge filter enabled
@ -912,6 +914,9 @@ func CloneWithoutFilters(flags CloneFlags, args []string) error {
if len(flags.ShallowExclude) > 0 {
cmdargs = append(cmdargs, "--shallow-exclude", flags.ShallowExclude)
}
if flags.ShallowSubmodules {
cmdargs = append(cmdargs, "--shallow-submodules")
}
// Now args
cmdargs = append(cmdargs, args...)