admin/sync: Use globbing for ack handling
This commit is contained in:
parent
5d716106c4
commit
38a4e21e28
1 changed files with 9 additions and 1 deletions
|
@ -22,14 +22,22 @@ func (c *CheckExceptions) GetFileExceptions(paths ...string) *CheckExceptions {
|
||||||
ret := CheckExceptions{}
|
ret := CheckExceptions{}
|
||||||
|
|
||||||
for k, v := range *c {
|
for k, v := range *c {
|
||||||
|
cols := strings.SplitN(k, ":", 2)
|
||||||
|
if len(cols) < 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
for _, path := range paths {
|
for _, path := range paths {
|
||||||
if strings.HasPrefix(k, "*:") || strings.HasPrefix(k, path) {
|
if strings.HasPrefix(cols[0], path) {
|
||||||
k = strings.TrimPrefix(k, path)
|
k = strings.TrimPrefix(k, path)
|
||||||
|
|
||||||
if strings.HasPrefix(k, "/") {
|
if strings.HasPrefix(k, "/") {
|
||||||
k = strings.TrimPrefix(k, "/")
|
k = strings.TrimPrefix(k, "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret[k] = v
|
||||||
|
break
|
||||||
|
} else if eval, err := filepath.Match(cols[0], path); err == nil && eval {
|
||||||
ret[k] = v
|
ret[k] = v
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue