mirror of
				https://github.com/taigrr/yq
				synced 2025-01-18 04:53:17 -08:00 
			
		
		
		
	Fixed merge dropping anchors
This commit is contained in:
		
							parent
							
								
									ca10ede102
								
							
						
					
					
						commit
						ebfc7212e2
					
				| @ -63,8 +63,6 @@ func (n *CandidateNode) UpdateFrom(other *CandidateNode) { | ||||
| 	n.UpdateAttributesFrom(other) | ||||
| 	n.Node.Content = other.Node.Content | ||||
| 	n.Node.Value = other.Node.Value | ||||
| 	n.Node.Alias = other.Node.Alias | ||||
| 	n.Node.Anchor = other.Node.Anchor | ||||
| } | ||||
| 
 | ||||
| func (n *CandidateNode) UpdateAttributesFrom(other *CandidateNode) { | ||||
| @ -76,6 +74,8 @@ func (n *CandidateNode) UpdateAttributesFrom(other *CandidateNode) { | ||||
| 	} | ||||
| 	n.Node.Kind = other.Node.Kind | ||||
| 	n.Node.Tag = other.Node.Tag | ||||
| 	n.Node.Alias = other.Node.Alias | ||||
| 	n.Node.Anchor = other.Node.Anchor | ||||
| 
 | ||||
| 	// merge will pickup the style of the new thing | ||||
| 	// when autocreating nodes | ||||
|  | ||||
| @ -13,6 +13,14 @@ var multiplyOperatorScenarios = []expressionScenario{ | ||||
| 			"D0, P[], (!!map)::{a: {also: me}, b: {also: me}}\n", | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		skipDoc:    true, | ||||
| 		document:   `{a: &a { b: &b { c: &c cat } } }`, | ||||
| 		expression: `{} * .`, | ||||
| 		expected: []string{ | ||||
| 			"D0, P[], (!!map)::{a: &a {b: &b {c: &c cat}}}\n", | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		skipDoc:    true, | ||||
| 		document:   `{a: 2, b: 5}`, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user