walk: filter \set keywords correctly

When checking if a new set is needed (curSet != nil),
curSet wasn't being filtered against the actual keywords
a user specifies. Thus, if `defaultSetKeywords` includes "flags", but
the `keywords` argument for Walk() doesn't include "flags", "flags"
was included in the new \set, which isn't expected behavior. Instead,
we want to use keywordSelector function to make sure that we use
intended user-specified keywords.

Signed-off-by: Stephen Chung <schung@redhat.com>
This commit is contained in:
Stephen Chung 2016-07-21 11:31:45 -04:00
parent 52a31746bf
commit 0223187e76

View file

@ -106,7 +106,7 @@ func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHie
Name: "/set", Name: "/set",
Type: SpecialType, Type: SpecialType,
Pos: len(creator.DH.Entries), Pos: len(creator.DH.Entries),
Keywords: append(defaultSetKeywords, klist...), Keywords: keywordSelector(append(defaultSetKeywords, klist...), keywords),
} }
creator.curSet = &e creator.curSet = &e
creator.DH.Entries = append(creator.DH.Entries, e) creator.DH.Entries = append(creator.DH.Entries, e)