josephburnett / jd

JSON diff and patch
MIT License
1.62k stars 48 forks source link

Remove redundant ["set"] metadata from diff #26

Closed josephburnett closed 1 month ago

josephburnett commented 3 years ago

The ["set"] metadata emitted by the diff operations is not strictly necessary. The use of an object implies set semantics and it works fine without it.

jd should stop emitting that metadata (but should continue supporting its explicit use). Makes the simple use cases easier to read.

josephburnett commented 2 years ago

Instead of

@ ["foo",["set"],{}]
- "bar"
+ "baz"

we should emit

@ ["foo",{}]
- "bar"
+ "baz"

because it’s visually cleaner and they do the same thing.

josephburnett commented 1 month ago

The new v2 format does this. And metadata will be included on a dedicated line above each hunk when required.

$ jd -v2 -set ~/a.json ~/b.json
@ ["foo",{}]
- "bar"
+ "baz"

So I'm not going to bother with v1.