Skip to content

Commit

Permalink
ignore vcs dir
Browse files Browse the repository at this point in the history
  • Loading branch information
hhatto committed Apr 6, 2016
1 parent 9d8b341 commit 21a4437
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
)

Expand Down Expand Up @@ -56,11 +57,13 @@ func checkMD5Sum(filename string) (ignore bool) {
}

func getAllFiles(paths []string, languages map[string]*Language) (filenum, maxPathLen int) {
reVCS := regexp.MustCompile("(.bzr|.cvs|.hg|.git|.svn)")
maxPathLen = 0
for _, root := range paths {
if _, err := os.Stat(root); err != nil {
continue
}
vcsInRoot := reVCS.MatchString(root)
walkCallback := func(path string, info os.FileInfo, err error) error {
if info.IsDir() {
return nil
Expand All @@ -71,6 +74,10 @@ func getAllFiles(paths []string, languages map[string]*Language) (filenum, maxPa
return nil
}

if !vcsInRoot && reVCS.MatchString(path) {
return nil
}

p := filepath.Join(root, rel)

// check not-match directory
Expand Down

0 comments on commit 21a4437

Please sign in to comment.