File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,6 +70,9 @@ var DefaultExcludePatterns = []string{
7070 "shell-snapshots" ,
7171 "telemetry" ,
7272 "sessionStorage" ,
73+ "node_modules" ,
74+ "paste-cache" ,
75+ "image-cache" ,
7376 // Files
7477 "history.jsonl" ,
7578 "stats-cache.json" ,
@@ -153,6 +156,10 @@ func (c *Config) ShouldExclude(relPath string) bool {
153156 if relPathNorm == patternLower || strings .HasPrefix (relPathNorm , patternLower + "/" ) {
154157 return true
155158 }
159+ // Match pattern as a path component anywhere in the path (e.g. .git in nested dirs)
160+ if strings .Contains (relPathNorm , "/" + patternLower + "/" ) || strings .HasSuffix (relPathNorm , "/" + patternLower ) {
161+ return true
162+ }
156163 // Exact filename match
157164 if strings .ToLower (filename ) == patternLower {
158165 return true
Original file line number Diff line number Diff line change @@ -37,14 +37,28 @@ func FileChecksum(path string) (string, error) {
3737 return hex .EncodeToString (h .Sum (nil )), nil
3838}
3939
40- // WalkFiles walks a directory and returns all file paths
40+ // WalkFiles walks a directory and returns all file paths, skipping symlinks and irregular files
4141func WalkFiles (root string ) ([]string , error ) {
4242 var files []string
4343 err := filepath .Walk (root , func (path string , info os.FileInfo , err error ) error {
4444 if err != nil {
4545 return err
4646 }
47+ // Skip symlinks: check both the symlink bit and irregular files
48+ // On Windows, os.Lstat may not set ModeSymlink for junction points,
49+ // so also skip files that are neither regular files nor directories
50+ linfo , lerr := os .Lstat (path )
51+ if lerr != nil {
52+ return nil
53+ }
54+ mode := linfo .Mode ()
55+ if mode & os .ModeSymlink != 0 {
56+ return nil
57+ }
4758 if ! info .IsDir () {
59+ if ! mode .IsRegular () {
60+ return nil
61+ }
4862 files = append (files , path )
4963 }
5064 return nil
You can’t perform that action at this time.
0 commit comments