Skip to content

Commit

Permalink
empty ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Dec 27, 2022
1 parent 78522b2 commit eb160a0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

const (
name = "files"
version = "0.3.7"
version = "0.3.8"
revision = "HEAD"
)

Expand Down Expand Up @@ -65,7 +65,7 @@ func makeWalkFn(cfg *config, processMatch walkFn) walkFn {
return nil
}
if info.IsDir() {
if cfg.ignorere.MatchString(path) {
if cfg.ignorere != nil && cfg.ignorere.MatchString(path) {
return filepath.SkipDir
}
return processMatch(path, info)
Expand All @@ -85,7 +85,7 @@ func makeWalkFn(cfg *config, processMatch walkFn) walkFn {
return nil
}
if !info.IsDir() {
if cfg.ignorere.MatchString(path) {
if cfg.ignorere != nil && cfg.ignorere.MatchString(path) {
return filepath.SkipDir
}
return processMatch(path, info)
Expand Down Expand Up @@ -217,10 +217,12 @@ func run() int {
if cfg.ignoreenv != "" {
cfg.ignore = os.Getenv(cfg.ignoreenv)
}
cfg.ignorere, err = regexp.Compile(cfg.ignore)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
if cfg.ignore != "" {
cfg.ignorere, err = regexp.Compile(cfg.ignore)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
base := "."
if flag.NArg() > 0 {
Expand Down

0 comments on commit eb160a0

Please sign in to comment.