|
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.
legit/routes/util.go
Line 63 in 5acac24
legit uses basic
filepath.WalkDirto 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:
Then check
checkPathwithgit.PlainOpen, if it is, resolve the canonical path to not add duplicates, and add to repos.