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

merge empty array #2224

Open
jerome-laforge opened this issue Dec 11, 2024 · 0 comments
Open

merge empty array #2224

jerome-laforge opened this issue Dec 11, 2024 · 0 comments
Labels

Comments

@jerome-laforge
Copy link

Describe the bug
unexpected merge array if we have empty array

Version of yq: 4.44.6
Operating system: linux

Input Yaml
data1.yml:

list:
  - 1

data2.yml:

list:

data3.yml:

list:
  - 3

Command
The command you ran:

yq ea '. as $item ireduce ({}; . *+ $item )' *.yml > result.yml

Actual behavior

result.yml

list:
  - 3

Expected behavior

list:
  - 1
  - 3

Additional context
entry -1 has been removed

but if we exclude data2.yml file (with yq ea '. as $item ireduce ({}; . *+ $item )' data1.yml data3.yml > result.yml), that works as expected.

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

1 participant