mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 10:15:22 +00:00
Merge pull request #5155 from ephesused/eliminate-unnecessary-rnode
perf: eliminate unnecessary RNode creation
This commit is contained in:
@@ -450,15 +450,13 @@ func (rn *RNode) getMetaData() *yaml.Node {
|
||||
if IsMissingOrNull(rn) {
|
||||
return nil
|
||||
}
|
||||
var n *RNode
|
||||
content := rn.Content()
|
||||
if rn.YNode().Kind == DocumentNode {
|
||||
// get the content if this is the document node
|
||||
n = NewRNode(rn.Content()[0])
|
||||
} else {
|
||||
n = rn
|
||||
content = content[0].Content
|
||||
}
|
||||
var mf *yaml.Node
|
||||
visitMappingNodeFields(n.Content(), func(key, value *yaml.Node) {
|
||||
visitMappingNodeFields(content, func(key, value *yaml.Node) {
|
||||
if !IsYNodeNilOrEmpty(value) {
|
||||
mf = value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user