prow/plugins/approve/approvers/owners.go
func (o Owners) removeSubdirs(dirs sets.String) {
	canonicalize := func(p string) string {
		if p == "." {
			return ""
		}
		return p
	}
	for _, dir := range dirs.List() {
		path := dir
		for {
			if o.repo.IsNoParentOwners(path) || canonicalize(path) == "" {
				break
			}
			path = filepath.Dir(path)
			if dirs.Has(canonicalize(path)) {
				dirs.Delete(dir)
				break
			}
		}
	}
}
func (o Owners) removeSubdirs(dirs sets.String) {
	canonicalize := func(p string) string {
		if p == "." {
			return ""
		}
		return p
	}
	for _, dir := range dirs.List() {
		path := dir
		for {
			if o.repo.IsNoParentOwners(path) || canonicalize(path) == "" {
				break
			}
			path = filepath.Dir(path)
			if dirs.Has(canonicalize(path)) {
				dirs.Delete(dir)
				break
			}
		}
	}
}
func ( o Owners ) removeSubdirs ( dirs sets . String ) { canonicalize := func ( p string ) string { if p == " " { return " " } return p } for _ , dir := range dirs . List ( ) { path := dir for { if o . repo . IsNoParentOwners ( path ) || canonicalize ( path ) == " " { break } path = filepath . Dir ( path ) if dirs . Has ( canonicalize ( path ) ) { dirs . Delete ( dir ) break } } } }
// removeSubdirs takes a set of directories as an input and removes all subdirectories.
// E.g. [a, a/b/c, d/e, d/e/f] -> [a, d/e]
// Subdirs will not be removed if they are configured to have no parent OWNERS files or if any
// OWNERS file in the relative path between the subdir and the higher level dir is configured to
// have no parent OWNERS files.
removeSubdirs takes a set of directories as an input and removes all subdirectories . E . g . [ a a / b / c d / e d / e / f ] - > [ a d / e ] Subdirs will not be removed if they are configured to have no parent OWNERS files or if any OWNERS file in the relative path between the subdir and the higher level dir is configured to have no parent OWNERS files .