libgit2/libgit2 — pull request #1014 by arrbee (2012-10-23 23:51:15+00:00)
Title: Initial implementation of diff rename detection

This implements the basis for diff rename and copy detection. I've intentionally only implemented simple SHA comparison instead of using a real similarity measurement (i.e. it only detects exact matches for renames or copies) because I want to focus on the design of the rename detection API, etc. I do have an initial implementation of file similarity measurement, but I felt like that should be reserved for a future PR.

Just as `git_diff_merge()` can be used as a post-pass on diffs to emulate certain command line behaviors, this adds a new post-diff API `git_diff_detect()` which will update a diff list in-place, adjusting some deltas to RENAMED or COPIED state (and also, eventually, splitting MODIFIED deltas where the change is too large into DELETED/ADDED pairs).

This also adds a new test repo that will hold rename/copy/split scenarios. Right now, it just has exact-match rename and copy, but the tests are written to use tree diffs, so we should be able to add new test scenarios easily without breaking tests.