prow/repoowners/repoowners.go
func (o *RepoOwners) entriesForFile(path string, people map[string]map[*regexp.Regexp]sets.String, leafOnly bool) sets.String {
	d := path
	if !o.enableMDYAML || !strings.HasSuffix(path, ".md") {
		// if path is a directory, this will remove the leaf directory, and returns "." for topmost dir
		d = filepath.Dir(d)
		d = canonicalize(path)
	}

	out := sets.NewString()
	for {
		relative, err := filepath.Rel(d, path)
		if err != nil {
			o.log.WithError(err).WithField("path", path).Errorf("Unable to find relative path between %q and path.", d)
			return nil
		}
		for re, s := range people[d] {
			if re == nil || re.MatchString(relative) {
				out.Insert(s.List()...)
			}
		}
		if leafOnly && out.Len() > 0 {
			break
		}
		if d == baseDirConvention {
			break
		}
		if o.options[d].NoParentOwners {
			break
		}
		d = filepath.Dir(d)
		d = canonicalize(d)
	}
	return out
}
func (o *RepoOwners) entriesForFile(path string, people map[string]map[*regexp.Regexp]sets.String, leafOnly bool) sets.String {
	d := path
	if !o.enableMDYAML || !strings.HasSuffix(path, ".md") {
		// if path is a directory, this will remove the leaf directory, and returns "." for topmost dir
		d = filepath.Dir(d)
		d = canonicalize(path)
	}

	out := sets.NewString()
	for {
		relative, err := filepath.Rel(d, path)
		if err != nil {
			o.log.WithError(err).WithField("path", path).Errorf("Unable to find relative path between %q and path.", d)
			return nil
		}
		for re, s := range people[d] {
			if re == nil || re.MatchString(relative) {
				out.Insert(s.List()...)
			}
		}
		if leafOnly && out.Len() > 0 {
			break
		}
		if d == baseDirConvention {
			break
		}
		if o.options[d].NoParentOwners {
			break
		}
		d = filepath.Dir(d)
		d = canonicalize(d)
	}
	return out
}
func ( o * RepoOwners ) entriesForFile ( path string , people map [ string ] map [ * regexp . Regexp ] sets . String , leafOnly bool ) sets . String { d := path if ! o . enableMDYAML || ! strings . HasSuffix ( path , " " ) { // if path is a directory, this will remove the leaf directory, and returns "." for topmost dir d = filepath . Dir ( d ) d = canonicalize ( path ) } out := sets . NewString ( ) for { relative , err := filepath . Rel ( d , path ) if err != nil { o . log . WithError ( err ) . WithField ( " " , path ) . Errorf ( " " , d ) return nil } for re , s := range people [ d ] { if re == nil || re . MatchString ( relative ) { out . Insert ( s . List ( ) ... ) } } if leafOnly && out . Len ( ) > 0 { break } if d == baseDirConvention { break } if o . options [ d ] . NoParentOwners { break } d = filepath . Dir ( d ) d = canonicalize ( d ) } return out }
// entriesForFile returns a set of users who are assignees to the
// requested file. The path variable should be a full path to a filename
// and not directory as the final directory will be discounted if enableMDYAML is true
// leafOnly indicates whether only the OWNERS deepest in the tree (closest to the file)
// should be returned or if all OWNERS in filepath should be returned
entriesForFile returns a set of users who are assignees to the requested file . The path variable should be a full path to a filename and not directory as the final directory will be discounted if enableMDYAML is true leafOnly indicates whether only the OWNERS deepest in the tree ( closest to the file ) should be returned or if all OWNERS in filepath should be returned