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

Function getWrapperClone

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

Source from the content-addressed store, hash-verified

36}
37
38func getWrapperClone(dep models.Dependency) {
39 checkHasGitClient()
40
41 paths.EnsureCacheDir(dep)
42
43 dirModule := filepath.Join(env.GetModulesDir(), dep.GetName())
44 dir := "--separate-git-dir=" + filepath.Join(env.GetCacheDir(), dep.GetHashName())
45
46 err := os.RemoveAll(dirModule)
47 if !os.IsNotExist(err) {
48 utils.HandleError(err)
49 }
50 err = os.Remove(dirModule)
51 if !os.IsNotExist(err) {
52 utils.HandleError(err)
53 }
54
55 cmd := exec.Command("git", "clone", dir, dep.GetURL(), dirModule)
56
57 if err := runCommand(cmd); err != nil {
58 msg.Die(err.Error())
59 }
60 initSubmodulesNative(dep)
61
62 _ = os.Remove(filepath.Join(dirModule, ".git"))
63
64}
65
66func writeDotGitFile(dep models.Dependency) {
67 mask := fmt.Sprintf("gitdir: %s\n", filepath.Join(env.GetCacheDir(), dep.GetHashName()))

Callers 1

CloneCacheNativeFunction · 0.85

Calls 11

EnsureCacheDirFunction · 0.92
GetModulesDirFunction · 0.92
GetCacheDirFunction · 0.92
HandleErrorFunction · 0.92
DieFunction · 0.92
checkHasGitClientFunction · 0.85
runCommandFunction · 0.85
initSubmodulesNativeFunction · 0.85
GetNameMethod · 0.80
GetHashNameMethod · 0.80
GetURLMethod · 0.80

Tested by

no test coverage detected