GumTreeDiff / gumtree

An awesome code differencing tool
https://github.com/GumTreeDiff/gumtree/wiki
GNU Lesser General Public License v3.0
909 stars 171 forks source link

how to diff JSON files with Gumtree? #273

Open monperrus opened 2 years ago

monperrus commented 2 years ago

Hi @jrfaller

how to diff JSON files with Gumtree?

Thanks,

jrfaller commented 2 years ago

Hi @monperrus,

Currently it's not possible.

We have a JSON differ compliant with the RFC Json patch here : https://github.com/caohanyang/json_diff_rfc6902 (beware it's not maintained anymore).

Also there is a tree sitter grammar (https://github.com/tree-sitter/tree-sitter-json) that could be integrated easily into GumTree.

Cheers!

monperrus commented 2 years ago

Ack, thanks @jrfaller

FTR, we look into https://github.com/gnieh/diffson by @satabin

cc/ @algomaster99 @khaes-kth FYI

jrfaller commented 2 years ago

OK don't hesitate to tell me how it works with diffson, AFAIK it seems to be using sequence algorithms (LCS, Patience)?

FYI we have a small benchmark in our publication on the subject: https://hal.archives-ouvertes.fr/hal-01433078/document

Cheers!

satabin commented 2 years ago

Hi @jrfaller, it does use LCS based diff for arrays, and does not generate patches with move action. I was investigating other algorithms a while ago but haven’t looked into it for a while. I will have a look at JDR, it sounds interesting.