Patience diff

It turns out that moving a bunch of text inside one of the tex files is a very bad case for git’s diff algorithm. But if you use the patience diff using a switch then it works fine. For example

$ git --no-pager log --oneline --stat -n1 a081d8a
a081d8a Moved sections
more-morphisms.tex |11761 ++++++++++++++++++++++++++--------------------------
1 files changed, 5879 insertions(+), 5882 deletions(-)

and with patience diff I get

$ git --no-pager log --oneline --stat --patience -n1 a081d8a
a081d8a Moved sections
more-morphisms.tex | 1717 ++++++++++++++++++++++++++--------------------------
1 files changed, 857 insertions(+), 860 deletions(-)

I use “git diff” to quickly review what I’ve changed since the last commit. I was annoyed that moving a section or a lemma caused what is clearly the wrong output. Now I know how to avoid it.

The (entirely uninteresting) diff for the commit mentioned above can be found here. This link in particular shows that github doesn’t use patience diff!