diff --git a/commands/command_clone.go b/commands/command_clone.go index 854642fa..8bedc307 100644 --- a/commands/command_clone.go +++ b/commands/command_clone.go @@ -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") diff --git a/git/git.go b/git/git.go index 2d781965..6c43d762 100644 --- a/git/git.go +++ b/git/git.go @@ -804,6 +804,8 @@ type CloneFlags struct { ShallowSince string // --shallow-since 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...)