DetectGit detects if current directory is a Git repository
()
| 18 | |
| 19 | // DetectGit detects if current directory is a Git repository |
| 20 | func 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 | |
| 34 | func ScalingoRepoAutoComplete(ctx context.Context, dir string) []string { |
| 35 | var repos []string |
no outgoing calls
no test coverage detected