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

bug with yaml long string #52

Open
zhaogaolong opened this issue Feb 20, 2024 · 1 comment
Open

bug with yaml long string #52

zhaogaolong opened this issue Feb 20, 2024 · 1 comment

Comments

@zhaogaolong
Copy link

zhaogaolong commented Feb 20, 2024

I want diff long string values, but give wrong result

test case

c.yaml

data:
  config: |
    logging.a: false
    logging.b: false

d.yaml

data:
  config: |
    logging.a: false
    logging.c: false

the d.yaml delete logging.b: false and add logging.c: false

but result:

--- example/c.ymal
+++ example/d.yaml

  data:
-   config: "logging.a: false
logging.b: false
"
+   config: "logging.a: false
logging.c: false

"

The correct result is
图片

ref:

@sters
Copy link
Owner

sters commented Mar 1, 2024

@zhaogaolong

I fixed partially this issue. It is string handling issue when dump diff.
ref. 80c22c7

So far, this yaml-diff only handles key-value pair and structure. It means showing "There is a diff in the key" even if there is multiline strings.
This is because go-yaml that is yaml parser used in yaml-diff only has the information that it is a string. Maybe a custom type could be used to get a more detailed diff as you mentioned, with the information that it is a multi-line string. Or, maybe re-calculate detailed diff if the diff is in string values in dump phase.

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

No branches or pull requests

2 participants