6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-07 14:39:15 +00:00

Add repo finder tests

This commit is contained in:
Grzegorz Dlugoszewski
2020-07-08 14:58:19 +02:00
parent cdca8b89d9
commit 13e936c376
4 changed files with 116 additions and 20 deletions

View File

@@ -81,12 +81,13 @@ func (r *RepoFinder) walkCb(path string, ent *godirwalk.Dirent) error {
r.repos = append(r.repos, strings.TrimSuffix(path, ".git"))
return errSkipNode
}
// Do not traverse directories containing a .git directory
if ent.IsDir() {
_, err := os.Stat(filepath.Join(path, ".git"))
if err == nil {
r.repos = append(r.repos, strings.TrimSuffix(path, ".git"))
return ErrSkipNode
return errSkipNode
}
}
return nil