filter: warn the user if he use --include and --exclude together fixes #1764
Signed-off-by: Ernest Borowski <er.borowski@gmail.com>
This commit is contained in:
committed by
Nick Craig-Wood
parent
006b296c34
commit
934df67aef
@@ -156,6 +156,7 @@ func NewFilter() (f *Filter, err error) {
|
||||
MaxSize: int64(maxSize),
|
||||
}
|
||||
addImplicitExclude := false
|
||||
foundExcludeRule := false
|
||||
|
||||
if includeRule != nil {
|
||||
for _, rule := range *includeRule {
|
||||
@@ -183,6 +184,7 @@ func NewFilter() (f *Filter, err error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
foundExcludeRule = true
|
||||
}
|
||||
}
|
||||
if excludeFrom != nil {
|
||||
@@ -193,8 +195,14 @@ func NewFilter() (f *Filter, err error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
foundExcludeRule = true
|
||||
}
|
||||
}
|
||||
|
||||
if addImplicitExclude && foundExcludeRule {
|
||||
Infof(nil, "Using --filter is recommended instead of both --include and --exclude as the order they are parsed in is indeterminate")
|
||||
}
|
||||
|
||||
if filterRule != nil {
|
||||
for _, rule := range *filterRule {
|
||||
err = f.AddRule(rule)
|
||||
|
||||
Reference in New Issue
Block a user