MCPcopy Create free account
hub / github.com/HashLoad/boss / getWrapperFetch

Function getWrapperFetch

core/gitWrapper/git_native.go:72–99  ·  view source on GitHub ↗
(dep models.Dependency)

Source from the content-addressed store, hash-verified

70}
71
72func getWrapperFetch(dep models.Dependency) {
73 checkHasGitClient()
74
75 dirModule := filepath.Join(env.GetModulesDir(), dep.GetName())
76
77 if _, err := os.Stat(dirModule); os.IsNotExist(err) {
78 err := os.MkdirAll(dirModule, os.ModePerm)
79 utils.HandleError(err)
80 }
81
82 writeDotGitFile(dep)
83 cmdReset := exec.Command("git", "reset", "--hard")
84 cmdReset.Dir = dirModule
85 if err := runCommand(cmdReset); err != nil {
86 msg.Die(err.Error())
87 }
88
89 cmd := exec.Command("git", "fetch", "--all")
90 cmd.Dir = dirModule
91
92 if err := runCommand(cmd); err != nil {
93 msg.Die(err.Error())
94 }
95
96 initSubmodulesNative(dep)
97
98 _ = os.Remove(filepath.Join(dirModule, ".git"))
99}
100
101func initSubmodulesNative(dep models.Dependency) {
102 dirModule := filepath.Join(env.GetModulesDir(), dep.GetName())

Callers 1

UpdateCacheNativeFunction · 0.85

Calls 8

GetModulesDirFunction · 0.92
HandleErrorFunction · 0.92
DieFunction · 0.92
checkHasGitClientFunction · 0.85
writeDotGitFileFunction · 0.85
runCommandFunction · 0.85
initSubmodulesNativeFunction · 0.85
GetNameMethod · 0.80

Tested by

no test coverage detected