Support subtracting sources from globs
Support -file or -path/glob in file lists that contain globs to
subtract files from the resulting glob. Also move source file
prefixing and handling into a common function.
Change-Id: Ib6d74ce22f53cae7348c4ba35b779976d90359a6
diff --git a/glob/glob.go b/glob/glob.go
index a8c348d..a07501a 100644
--- a/glob/glob.go
+++ b/glob/glob.go
@@ -65,7 +65,12 @@
}
if match {
for _, e := range excludes {
- excludeMatch, err := filepath.Match(e, info.Name())
+ var excludeMatch bool
+ if filepath.Base(e) == e {
+ excludeMatch, err = filepath.Match(e, info.Name())
+ } else {
+ excludeMatch, err = filepath.Match(e, path)
+ }
if err != nil {
return err
}