MCPcopy Create free account
hub / github.com/JordanCoin/codemap / findNestedGitRepos

Function findNestedGitRepos

scanner/astgrep.go:191–208  ·  view source on GitHub ↗

findNestedGitRepos returns subdirectory names that contain their own .git These are separate repositories (not submodules) that should be excluded from scanning to avoid hanging on large nested repos.

(root string)

Source from the content-addressed store, hash-verified

189// These are separate repositories (not submodules) that should be excluded
190// from scanning to avoid hanging on large nested repos.
191func findNestedGitRepos(root string) []string {
192 entries, err := os.ReadDir(root)
193 if err != nil {
194 return nil
195 }
196
197 var repos []string
198 for _, e := range entries {
199 if !e.IsDir() || strings.HasPrefix(e.Name(), ".") {
200 continue
201 }
202 gitPath := filepath.Join(root, e.Name(), ".git")
203 if info, err := os.Stat(gitPath); err == nil && info.IsDir() {
204 repos = append(repos, e.Name())
205 }
206 }
207 return repos
208}
209
210// ScanDirectory analyzes all files in a directory using sg scan
211func (s *AstGrepScanner) ScanDirectory(root string) ([]FileAnalysis, error) {

Callers 1

ScanDirectoryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected