Fix compare different node tag

This commit is contained in:
Hugo Stijns
2022-12-29 15:37:21 +01:00
committed by Dave Shanley
parent fc7da1d38d
commit d6031b5440
4 changed files with 82 additions and 12 deletions

View File

@@ -171,14 +171,8 @@ func CheckForAddition[T any](l, r *yaml.Node, label string, changes *[]*Change,
//
// The Change is then added to the slice of []Change[T] instances provided as a pointer.
func CheckForModification[T any](l, r *yaml.Node, label string, changes *[]*Change, breaking bool, orig, new T) {
if l != nil && l.Value != "" && r != nil && r.Value != "" && r.Value != l.Value && r.Tag == l.Tag {
if l != nil && l.Value != "" && r != nil && r.Value != "" && (r.Value != l.Value || r.Tag != l.Tag) {
CreateChange(changes, Modified, label, l, r, breaking, orig, new)
return
}
// the values may have not changed, but the tag (node type) type may have
if l != nil && l.Value != "" && r != nil && r.Value != "" && r.Value != l.Value && r.Tag != l.Tag {
CreateChange(changes, Modified, label, l, r, breaking, orig, new)
return
}
}