Skip to content

Commit

Permalink
refactoring: move condition
Browse files Browse the repository at this point in the history
  • Loading branch information
haya14busa committed Oct 5, 2019
1 parent 384484d commit d60c334
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ghglob.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func Glob(files chan<- string, patterns []string, opt Option) error {
}

if typ.IsDir() {
if p != strings.TrimSuffix(rootPrefix, "/") && p != "/" && shouldSkipDir(subms, p) {
if p != strings.TrimSuffix(rootPrefix, "/") && shouldSkipDir(subms, p) {
return filepath.SkipDir
}
return nil
Expand Down Expand Up @@ -106,7 +106,7 @@ func buildSubMatchers(patterns []string) ([]*ghmatcher.Matcher, error) {
}

func shouldSkipDir(ms []*ghmatcher.Matcher, path string) bool {
if len(ms) == 0 || path == "." {
if len(ms) == 0 || path == "." || path == "/" {
return false
}
for _, m := range ms {
Expand Down

0 comments on commit d60c334

Please sign in to comment.