libgit2/libgit2 — pull request #1979 by arrbee (2013-12-02 21:36:21+00:00)
Title: Add GIT_DIFF_FIND_DELETE_UNMODIFIED flag and fix copy detection bug

When doing copy detection, it is often necessary to include `UNMODIFIED` records in the `git_diff` so they are available as source records for `GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED`. Yet in the final diff, often you will not want to have these `UNMODIFIED` records.

This PR adds a new flag (`GIT_DIFF_FIND_DELETE_UNMODIFIED`) which causes these `UNMODIFIED` records to be removed from the diff list after the rename/copy detection phase is over.

In developing this, I found a bug where the right side of a split delta (i.e. a `MODIFIED` record that has changed so much that `GIT_DIFF_FIND_AND_BREAK_REWRITES` will cause it to be split into a `DELETED` and `ADDED` pair) was never being considered a valid target for a `COPIED` record, even though it should be possible to split into a `DELETED` / `COPIED` pair. The first commit in this PR adds a test for that case and fixes the bug.