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

Function NewGitIgnoreCache

scanner/walker.go:24–34  ·  view source on GitHub ↗

NewGitIgnoreCache creates a cache that supports nested .gitignore files. root should be the project root directory.

(root string)

Source from the content-addressed store, hash-verified

22// NewGitIgnoreCache creates a cache that supports nested .gitignore files.
23// root should be the project root directory.
24func NewGitIgnoreCache(root string) *GitIgnoreCache {
25 absRoot, _ := filepath.Abs(root)
26 c := &GitIgnoreCache{
27 root: absRoot,
28 cache: make(map[string]*ignore.GitIgnore),
29 patterns: make(map[string][]string),
30 visited: make(map[string]struct{}),
31 }
32 c.tryLoadGitignore(absRoot)
33 return c
34}
35
36// tryLoadGitignore attempts to load a .gitignore from dir if not already visited.
37// Only adds to cache if a valid .gitignore exists.

Callers 15

buildBlastRadiusBundleFunction · 0.92
mainFunction · 0.92
resolveRepoFileCountFunction · 0.92
initProjectConfigFunction · 0.92
detectLanguagesFromFilesFunction · 0.92
countSourceFilesFunction · 0.92
handleGetStructureFunction · 0.92
handleGetDiffFunction · 0.92
handleFindFileFunction · 0.92
getProjectStatsFunction · 0.92
NewDaemonFunction · 0.92
TestNestedGitignoreFunction · 0.85

Calls 1

tryLoadGitignoreMethod · 0.95

Tested by 5

TestNestedGitignoreFunction · 0.68