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

missing/ merged comments with yq write #433

Closed
infa-ddeore opened this issue May 7, 2020 · 1 comment
Closed

missing/ merged comments with yq write #433

infa-ddeore opened this issue May 7, 2020 · 1 comment
Labels

Comments

@infa-ddeore
Copy link

Describe the bug
comments are messed up while using yq write

Input Yaml
data1.yml:

$ cat /tmp/4
# comment 1

---
# comment 2

---
# comment 3
 
---
# comment 4

---
# comment 5
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
  labels:
    app: some-label-gw
    istio: some-other-value
    release: istio
  minReplicas: 2

Command
The command you ran:

yq w -d3 /tmp/input.yaml metadata.labels.test value

Actual behavior

  1. comment 1 is removed
  2. comment 2 and comment 3 are merged
  3. blank element between comment 4 and comment 5
# comment 2
# comment 3
---


# comment 4
---

---
# comment 5
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
  labels:
    app: some-labels-like-custom-istio-ingressgateway
    istio: some-other-value
    release: istio
    test: value
  minReplicas: 2

Expected behavior
comments should be intact

Additional context

yq version 3.2.1
@infa-ddeore infa-ddeore added the bug label May 7, 2020
@infa-ddeore infa-ddeore changed the title messed up comments with yq write missing/ merged comments with yq write May 7, 2020
@mikefarah
Copy link
Owner

Duplicate of #427

@mikefarah mikefarah marked this as a duplicate of #427 May 20, 2020
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