this post was submitted on 22 Mar 2024
114 points (99.1% liked)

Programming

16760 readers
234 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
top 8 comments
sorted by: hot top controversial new old
[–] [email protected] 8 points 5 months ago (1 children)

Oh this is neat. I wonder if the license will accommodate my work (and my work is willing to allow a nonstandard diff)

[–] [email protected] 20 points 5 months ago

The license is MIT, so should be fine for most things

[–] [email protected] 5 points 5 months ago* (last edited 3 months ago) (1 children)

How does this compare with GumTree? It's weird that the page doesn't even mention existing state-of-the-art tools for this task.

edit: I've compared GumTree and difftastic myself while working on a project this past week. Difftastic is harder to use programatically (the JSON format is unstable and leaves something to be desired) but other than that it's miles and miles better.

[–] [email protected] 5 points 5 months ago

The manual talks about some of the older alternatives that influenced it. Doesn't directly compare them though https://difftastic.wilfred.me.uk/tree_diffing.html

[–] [email protected] -1 points 5 months ago (3 children)

I didn’t get a chance to look too deep into it, while it looks great for human reading in a terminal, can I just as easily output the diff to a patch file like I do often with ‘git diff [commit] [commit] > patch.txt and git apply it?

[–] [email protected] 15 points 5 months ago

Doesn't look like it, from their docs:

Non-goals

Patching. Difftastic output is intended for human consumption, and it does not generate patches that you can apply later. Use diff if you need a patch.

[–] [email protected] 2 points 5 months ago

Since the diffs are tree-sitter based, it's interesting to think about what a tree-sitter based patch would look like. Probably wouldn't double as a human and computer friendly format like normals diffs. I suppose that you could create patches that are more robust to the source code changing since it wouldn't care about linebreaks and maybe you could have it so it doesn't care if you move code around since you could have it so its going by e.g. what the parent function is and not the line number. I gotta wonder how useful that actually is though.

[–] [email protected] 1 points 5 months ago* (last edited 5 months ago)

Use diff for that?