Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression on merge operator #880

Closed
pierrecregut opened this issue Jul 4, 2021 · 4 comments
Closed

Regression on merge operator #880

pierrecregut opened this issue Jul 4, 2021 · 4 comments
Labels
Milestone

Comments

@pierrecregut
Copy link

Merge empty object with other seems to always give an empty object

Version of yq: >= 4.9.2 (4.9.1 is fine)
Operating system: linux (not tested on other)
Installed via: binary release

Input Yaml

data.yml:

source:
  a: 1
  b: 2

Command
The command you ran:

yq e '.sink = {} * .source' data.yaml

Actual behavior

source:
  a: 1
  b: 2
sink: {}

Expected behavior

source:
  a: 1
  b: 2
sink:
  a: 1
  b: 2

Additional context
None

@pierrecregut
Copy link
Author

As a side note yq e '{} * .source' data.yml gives the right result. So the title is a little misleading: the assignment is part of the problem.

@pierrecregut
Copy link
Author

According to git bisect commit 77edbb9 is the culprit. It is not related to {} as I thought earlier due to my initial use case, you can put whatever you want as lhs of * operator.

mikefarah added a commit that referenced this issue Jul 7, 2021
@mikefarah
Copy link
Owner

Thanks for the clear issue - found the bug, will be fixed in the next release

@mikefarah mikefarah added this to the 4.9.7 milestone Jul 7, 2021
@mikefarah
Copy link
Owner

Fixed in 4.9.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants