aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse/excluder.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/fusefrontend_reverse/excluder.go')
-rw-r--r--internal/fusefrontend_reverse/excluder.go20
1 files changed, 12 insertions, 8 deletions
diff --git a/internal/fusefrontend_reverse/excluder.go b/internal/fusefrontend_reverse/excluder.go
index 337c3d2..b6cb961 100644
--- a/internal/fusefrontend_reverse/excluder.go
+++ b/internal/fusefrontend_reverse/excluder.go
@@ -15,15 +15,19 @@ import (
// prepareExcluder creates an object to check if paths are excluded
// based on the patterns specified in the command line.
func prepareExcluder(args fusefrontend.Args) *ignore.GitIgnore {
- if len(args.Exclude) > 0 || len(args.ExcludeWildcard) > 0 || len(args.ExcludeFrom) > 0 {
- excluder, err := ignore.CompileIgnoreLines(getExclusionPatterns(args)...)
- if err != nil {
- tlog.Fatal.Printf("Error compiling exclusion rules: %q", err)
- os.Exit(exitcodes.ExcludeError)
- }
- return excluder
+ if len(args.Exclude) == 0 && len(args.ExcludeWildcard) == 0 && len(args.ExcludeFrom) == 0 {
+ return nil
+ }
+ patterns := getExclusionPatterns(args)
+ if len(patterns) == 0 {
+ panic(patterns)
+ }
+ excluder, err := ignore.CompileIgnoreLines(patterns...)
+ if err != nil {
+ tlog.Fatal.Printf("Error compiling exclusion rules: %v", err)
+ os.Exit(exitcodes.ExcludeError)
}
- return nil
+ return excluder
}
// getExclusionPatters prepares a list of patterns to be excluded.