libgit2/libgit2 — pull request #2453 by ethomson (2014-07-01 13:42:23+00:00)
Title: git_checkout_index: checkout other indexes

Modify `git_checkout_index` such that it can check out other `git_index`s (that are not necessarily the repository index). This allows `checkout_index` to use the repository's index for stat cache information instead of the index data being checked out. `git_merge` and friends now check out their indexes directly instead of trying to blend it into the running index.

This prevents an annoying bug for people who have CRLF-damaged repositories. Consider a file being deleted in the merge result: when computing the resultant index (to check out) we would remove that file from the repository's index (and its resultant stat cache). We can then not use the stat cache to determine if the file has been modified (on disk) and must fall back to comparing the workdir file to HEAD. If the libgit2 filter(s) were to behave differently than how the file is written, we will (erroneously) block the checkout.

Obsoletes #2383