Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions internal/pkg/repo/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"strings"
"sync"

"github.com/spf13/viper"
)
Expand Down Expand Up @@ -48,22 +49,28 @@ func GetRepoPathsChan(basedir string, includeExtras bool) <-chan string {
if !entry.IsDir() {
continue
}
if inExcludeList(basedir) {
continue
}
if entry.Name() == ".git" {
out <- basedir
return
}
subdirs = append(subdirs, entry.Name())
child := fmt.Sprintf("%s/%s", basedir, entry.Name())
if inExcludeList(child) {
continue
}
subdirs = append(subdirs, child)
}

for _, subdir := range subdirs {
subchan := GetRepoPathsChan(fmt.Sprintf("%s/%s", basedir, subdir), false)
for p := range subchan {
out <- p
}
var wg sync.WaitGroup
for _, child := range subdirs {
wg.Add(1)
go func(dir string) {
defer wg.Done()
for p := range GetRepoPathsChan(dir, false) {
out <- p
}
}(child)
}
wg.Wait()
}()

return out
Expand Down
Loading