(args []string)
| 104 | } |
| 105 | |
| 106 | func postCloneSubmodules(args []string) error { |
| 107 | // In git 2.9+ the filter option will have been passed through to submodules |
| 108 | // So we need to lfs pull inside each |
| 109 | if !git.IsGitVersionAtLeast("2.9.0") { |
| 110 | // In earlier versions submodules would have used smudge filter |
| 111 | return nil |
| 112 | } |
| 113 | // Also we only do this if --recursive or --recurse-submodules was provided |
| 114 | if !cloneFlags.Recursive && !cloneFlags.RecurseSubmodules { |
| 115 | return nil |
| 116 | } |
| 117 | |
| 118 | // Use `git submodule foreach --recursive` to cascade into nested submodules |
| 119 | // Also good to call a new instance of git-lfs rather than do things |
| 120 | // inside this instance, since that way we get a clean env in that subrepo |
| 121 | cmd, err := subprocess.ExecCommand("git", "submodule", "foreach", "--recursive", |
| 122 | "git lfs pull") |
| 123 | if err != nil { |
| 124 | return err |
| 125 | } |
| 126 | cmd.Stderr = os.Stderr |
| 127 | cmd.Stdin = os.Stdin |
| 128 | cmd.Stdout = os.Stdout |
| 129 | return cmd.Run() |
| 130 | } |
| 131 | |
| 132 | func init() { |
| 133 | RegisterCommand("clone", cloneCommand, func(cmd *cobra.Command) { |
no test coverage detected