josephburnett/jd

Remove redundant ["set"] metadata from diff

josephburnett opened this issue · 2 comments

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.

Instead of

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

we should emit

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

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

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.