-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Line 63 in 5acac24
| err := filepath.WalkDir(d.c.Repo.ScanPath, func(path string, de fs.DirEntry, err error) error { |
legit uses basic filepath.WalkDir to scan for git directories which does not follow symlinks by design.
This could be changed to at least check symlinks for being git repos and add them without recursing into them.
Something like:
if de.Type()&fs.ModeSymlink != 0 {
resolvedPath, err := os.Readlink(path)
if err != nil {
log.Printf("failed to read symlink %s: %v", path, err)
return nil
}
if !filepath.IsAbs(resolvedPath) {
resolvedPath = filepath.Join(filepath.Dir(path), resolvedPath)
}
checkPath = resolvedPath
}Then check checkPath with git.PlainOpen, if it is, resolve the canonical path to not add duplicates, and add to repos.
Metadata
Metadata
Assignees
Labels
No labels