MCPcopy Index your code
hub / github.com/celer-pkg/celer / UpdateSubmodules

Function UpdateSubmodules

pkgs/git/control.go:136–155  ·  view source on GitHub ↗

UpdateSubmodules update git submodules.

(title, repoDir string)

Source from the content-addressed store, hash-verified

134
135// UpdateSubmodules update git submodules.
136func UpdateSubmodules(title, repoDir string) error {
137 if !fileio.PathExists(repoDir) {
138 return errors.ErrDirNotExist
139 }
140 if !fileio.PathExists(filepath.Join(repoDir, ".git")) {
141 return errors.ErrNotGitDir
142 }
143
144 if !fileio.PathExists(filepath.Join(repoDir, ".gitmodules")) {
145 return nil
146 }
147
148 command := "git submodule update --init --recursive"
149 executor := cmd.NewExecutor(title, command)
150 executor.SetWorkDir(repoDir)
151 if output, err := executor.ExecuteOutputLive(); err != nil {
152 return fmt.Errorf("failed to update submodules: %s -> %w", output, err)
153 }
154 return nil
155}
156
157// UpdateRepo update git repo.
158func UpdateRepo(target, repoRef, repoDir string, force bool) error {

Callers 1

UpdateSubmodulesMethod · 0.92

Calls 4

PathExistsFunction · 0.92
NewExecutorFunction · 0.92
SetWorkDirMethod · 0.80
ExecuteOutputLiveMethod · 0.80

Tested by

no test coverage detected