libgit2/libgit2 — pull request #1595 by arrbee (2013-05-18 14:57:38+00:00)
Title: Even more rename detection fixes

Sigh.

So, rename detection has problems; it appears that the basic loop that I initially wrote got a few things wrong with the bookkeeping for which files were matched with which others. I've experimented with some tests that try random diffs in large repos coupled with rename detection and I was able to reproduce a number of problems. This PR fixes the problems I've found so far...

This PR does (or is that, will do) a few things:

- [x] Add rename detection options to `examples/diff.c`
- [x] Add `--raw` output helper function and add to `examples/diff.c`
- [x] Fixes to `git_diff_find_similar` to track file matches and similarity scores more carefully
- [x] Update `git_diff_find_similar` so finding "rewrites" and breaking them into separated add/delete records can be controlled separately (because `git diff --raw` finds these "rewrites" but just marks them as `M083` or something like that - i.e. `M` with a dissimilarity score, instead of actually splitting them).
- [x] Fix sorting function for diff to be aware of different status and use the correct left-side/right-side name
- [x] Clarify some documentation for rename detection public APIs
- [ ] Extend rename detection tests to exercise these complex cases better