Skip to content

merge empty array #2224

Open
Open
@jerome-laforge

Description

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.

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions