critic
critic copied to clipboard
Show useful diff for files that are both moved and edited
When a file is moved, critic shows it as one deleted file and one added file, which makes it hard to see what (if anything) has changed apart from the move. It would be more useful if it said that the file has moved from A to B and then show the diff of the edits.
Critic does have "moved code detection," activated by pressing 'm' while displaying a diff that includes the move. (This short-cut and others are "documented" at the bottom of the page.)
Oh, OK. Any -> any doesn't appear to work so well for https://critic.hoppipolla.co.uk/r/420 . I guess git doesn't give critic information about which files were moved?
Git doesn't know what's moved where any more than Critic does; Git doesn't store that information. Both Git and Critic has logic for figuring this out from a given diff. It's perfectly reasonable to think that Git's logic is better, and it's also possible Critic could access it somehow, but I think it's just as easy to just improve Critic's logic.
As for that particular diff: Yes, Critic's logic is known to go awry when multiple files are moved, and they share some common element (such as a similar file header.) This is something I've been meaning to look at improving, but have never gotten around to it.