Hacker News new | ask | show | jobs
by FabCH 32 days ago
Partially.

The default git diff uses the Myers diff algorithm as implemented in xdiff. It's a line based diff with some pre and post processing for better results.

The move detection is a post-processing step that only works on lines and additionally only works if you also enable coloured output.

It can't match "moved-but-eddited" code and it can't match "this one log line was copied 3 times in the new code" or the refactoring equivalent "these 2 blocks of code were merged into one reusable function".

You have to use more syntax-aware algorithms to get true move detection. OmniDiff matches the nodes of the AST to get some of that syntax awareness.