MCPcopy Create free account
hub / github.com/Scalingo/cli / DetectGit

Function DetectGit

utils/git.go:20–32  ·  view source on GitHub ↗

DetectGit detects if current directory is a Git repository

()

Source from the content-addressed store, hash-verified

18
19// DetectGit detects if current directory is a Git repository
20func DetectGit() (string, bool) {
21 cwd, err := os.Getwd()
22 if err != nil {
23 return "", false
24 }
25 for cwd != "/" {
26 if _, err := os.Stat(path.Join(cwd, ".git")); err == nil {
27 return cwd, true
28 }
29 cwd = filepath.Dir(cwd)
30 }
31 return "", false
32}
33
34func ScalingoRepoAutoComplete(ctx context.Context, dir string) []string {
35 var repos []string

Callers 5

CreateFunction · 0.92
FlagRemoteAutoCompleteFunction · 0.92
CurrentAppCompletionFunction · 0.92
extractAppNameFunction · 0.92
GetRegionFromGitRemoteFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected