Fixed handling of merging null #1501

This commit is contained in:
Mike Farah
2023-01-10 13:48:57 +11:00
parent ef2064c753
commit 9af55d555b
3 changed files with 83 additions and 2 deletions
+8 -2
View File
@@ -60,8 +60,14 @@ func multiply(preferences multiplyPreferences) func(d *dataTreeNavigator, contex
log.Debugf("Multiplying LHS: %v", lhs.Node.Tag)
log.Debugf("- RHS: %v", rhs.Node.Tag)
if lhs.Node.Kind == yaml.MappingNode && rhs.Node.Kind == yaml.MappingNode ||
(lhs.Node.Kind == yaml.SequenceNode && rhs.Node.Kind == yaml.SequenceNode) {
if rhs.Node.Tag == "!!null" {
return lhs.Copy()
}
if (lhs.Node.Kind == yaml.MappingNode && rhs.Node.Kind == yaml.MappingNode) ||
(lhs.Node.Tag == "!!null" && rhs.Node.Kind == yaml.MappingNode) ||
(lhs.Node.Kind == yaml.SequenceNode && rhs.Node.Kind == yaml.SequenceNode) ||
(lhs.Node.Tag == "!!null" && rhs.Node.Kind == yaml.SequenceNode) {
var newBlank = CandidateNode{}
err := copier.CopyWithOption(&newBlank, lhs, copier.Option{IgnoreEmpty: true, DeepCopy: true})
if err != nil {