MCPcopy
hub / github.com/git-lfs/git-lfs / postCloneSubmodules

Function postCloneSubmodules

commands/command_clone.go:106–130  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

104}
105
106func 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
132func init() {
133 RegisterCommand("clone", cloneCommand, func(cmd *cobra.Command) {

Callers 1

cloneCommandFunction · 0.85

Calls 3

IsGitVersionAtLeastFunction · 0.92
ExecCommandFunction · 0.92
RunMethod · 0.65

Tested by

no test coverage detected