mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-23 14:16:10 +00:00
Merge now copies anchor names
This commit is contained in:
parent
7518dac99c
commit
55712afea6
@ -61,6 +61,7 @@ func (n *CandidateNode) UpdateFrom(other *CandidateNode) {
|
||||
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) {
|
||||
|
@ -180,7 +180,7 @@ g: thongs
|
||||
f: *cat
|
||||
```
|
||||
|
||||
## Merge does not copy anchor names
|
||||
## Merge copies anchor names
|
||||
Given a sample.yml file of:
|
||||
```yaml
|
||||
a:
|
||||
@ -197,7 +197,7 @@ yq eval '.c * .a' sample.yml
|
||||
will output
|
||||
```yaml
|
||||
g: thongs
|
||||
c: frog
|
||||
c: &cat frog
|
||||
```
|
||||
|
||||
## Merge with merge anchors
|
||||
|
@ -132,11 +132,11 @@ b:
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Merge does not copy anchor names",
|
||||
description: "Merge copies anchor names",
|
||||
document: `{a: {c: &cat frog}, b: {f: *cat}, c: {g: thongs}}`,
|
||||
expression: `.c * .a`,
|
||||
expected: []string{
|
||||
"D0, P[c], (!!map)::{g: thongs, c: frog}\n",
|
||||
"D0, P[c], (!!map)::{g: thongs, c: &cat frog}\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user