diff tools cannot handle moving code blocks
- Adding a line: ✅
- Removing a line: ✅
- Modifying a line: ✅
- Moving a codeblock: ❌ i see you’ve rewritten everything, let me just highlight it all.
RIP reviewers on my PR.
(Meme created by my coworker)
![](https://kbin.cafe/media/cache/resolve/entry_thumb/1c/27/1c27651bf4efa9380c132f9ef2637231a2769d4985325a9af1e86f4584f2199b.png)
RIP reviewers on my PR.
(Meme created by my coworker)
dragnucs, Most diff tools have an option to ignore leading or trailing whitespace changes.
pomodoro_longbreak, ![]()
I think OP meant moving a code block up or down in a file, not left or right
PeriodicallyPedantic, Yes, thank you. I probably should have been more clear
bleistift2, I’m surprised that after almost 20 years of versioning C code, git still manages to assign the closing brace of a function wrongly.
sim642, Because text is text and all
}
are the same.
Kbin_space_program, laughs in IntelliJ
mormegil, ![]()
Try difftastic! github.com/Wilfred/difftastic
dill, ![]()
That logo tho. oh noooooo
flux, It doesn’t actually detect moved code, though, like
git diff
can? I gave it a shot and also there’s a couple issues open about it, e.g. github.com/Wilfred/difftastic/issues/520 .Other than that, difftastic is quite nice.
Blackbird, Beyond Compare is awesome and handles this and many other things quite well.
MJBrune, Perforce diff works better than this. Even my basic Git/Gitlab diffs don’t do this.
dream_weasel, Maybe specify a different diff algorithm? Histogram for example?
saigot, Me adding one if statement around around a code block. Ah shit I guess I own the whole function now.
Rednax, At least a good diff tool will ignore whitespace diffs.
sim642, How do you expect it to be shown though?
PeriodicallyPedantic, For example, on side by side views, you can draw a box around it on both sides, and draw a line connecting the two
Scrollone, I think Sublime Merge does this with the conflict resolution tool
csm10495, ![]()
Give me some love for adding an indent level either showing nothing changed or you rewrote everything too.
tastysnacks, If you’re going to rearrange code, have that as a separate check in from changing code.
Add comment