ref: 3ce59c3248dec0eb0f918c42f37f53bc2ac20425
dir: /object/tree/path_prefix.go/
package tree
import (
"bytes"
"slices"
)
// HasPathPrefix reports whether path begins with prefix as whole components.
func HasPathPrefix(path, prefix [][]byte) bool {
if len(prefix) == 0 {
return true
}
if len(path) < len(prefix) {
return false
}
return slices.EqualFunc(path[:len(prefix)], prefix, bytes.Equal)
}