Clarify filesystem directive and override ownership
This commit is contained in:
@@ -64,3 +64,23 @@ func documentAtPath(root *document.Node, path Path) (*document.Node, bool) {
|
||||
}
|
||||
return current, true
|
||||
}
|
||||
|
||||
// countInputNodes includes mapping-key nodes, unlike walkDocument's value-only
|
||||
// traversal. Aggregate source budgets charge every input occurrence.
|
||||
func countInputNodes(node *document.Node) int {
|
||||
if node == nil {
|
||||
return 0
|
||||
}
|
||||
count := 1
|
||||
if node.Kind == document.Mapping {
|
||||
count += len(node.Mapping)
|
||||
for _, entry := range node.Mapping {
|
||||
count += countInputNodes(entry.Value)
|
||||
}
|
||||
} else if node.Kind == document.Sequence {
|
||||
for _, child := range node.Sequence {
|
||||
count += countInputNodes(child)
|
||||
}
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user