@@ -13,13 +13,39 @@ import (
1313 "github.com/Bharath-code/git-scope/internal/model"
1414)
1515
16+ // smartIgnorePatterns are always-ignored directories for performance
17+ // These are system/tool directories that should never contain user repos
18+ var smartIgnorePatterns = []string {
19+ // macOS/Linux system directories
20+ "Library" , ".Trash" , ".cache" , ".local" ,
21+ // Package managers & runtimes
22+ ".npm" , ".yarn" , ".pnpm" , ".bun" , ".cargo" , ".rustup" , ".go" ,
23+ ".venv" , ".pyenv" , ".rbenv" , ".nvm" , ".sdkman" ,
24+ // IDE extensions (contain third-party repos, not your code)
25+ ".vscode" , ".vscode-server" , ".cursor" , ".zed" , ".idea" , ".atom" ,
26+ // Shell & tools configs
27+ ".oh-my-zsh" , ".tmux" , ".vim" , ".emacs.d" , ".gemini" ,
28+ // Docker/Cloud
29+ ".docker" , ".kube" , ".ssh" , ".gnupg" ,
30+ // Cloud sync (slow and likely duplicates)
31+ "Google Drive" , "OneDrive" , "Dropbox" , "iCloud" ,
32+ }
33+
1634// ScanRoots recursively scans the given root directories for git repositories
1735// It skips directories matching the ignore patterns
1836func ScanRoots (roots , ignore []string ) ([]model.Repo , error ) {
19- ignoreSet := make (map [string ]struct {}, len (ignore ))
37+ // Build ignore set from user config + smart defaults
38+ ignoreSet := make (map [string ]struct {}, len (ignore )+ len (smartIgnorePatterns ))
39+
40+ // Add user-defined ignores
2041 for _ , pattern := range ignore {
2142 ignoreSet [pattern ] = struct {}{}
2243 }
44+
45+ // Add smart defaults (always apply for performance)
46+ for _ , pattern := range smartIgnorePatterns {
47+ ignoreSet [pattern ] = struct {}{}
48+ }
2349
2450 var mu sync.Mutex
2551 var repos []model.Repo
0 commit comments