Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ad62c70 authored by Usta (Tsering) Shrestha's avatar Usta (Tsering) Shrestha Committed by Gerrit Code Review
Browse files

Merge "ShouldKeepExistingBuldFileForDir look up by dir"

parents 6f235d9b ea999641
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -341,17 +341,20 @@ func (a Bp2BuildConversionAllowlist) ShouldKeepExistingBuildFileForDir(dir strin
		// Exact dir match
		return true
	}
	var i int
	// Check if subtree match
	for prefix, recursive := range a.keepExistingBuildFile {
		if recursive {
			if strings.HasPrefix(dir, prefix+"/") {
	for {
		j := strings.Index(dir[i:], "/")
		if j == -1 {
			return false //default
		}
		prefix := dir[0 : i+j]
		i = i + j + 1 // skip the "/"
		if recursive, ok := a.keepExistingBuildFile[prefix]; ok && recursive {
			return true
		}
	}
}
	// Default
	return false
}

var bp2BuildAllowListKey = NewOnceKey("Bp2BuildAllowlist")
var bp2buildAllowlist OncePer