libgit2/libgit2 — pull request #1016 by arrbee (2012-10-25 00:49:03+00:00)
Title: Fix checkout with limited strategy and tree/blob conflicts

So, @nulltoken created a failing test case for checkout that proved to be particularly daunting. If checkout is given only a very limited strategy mask (e.g. just `GIT_CHECKOUT_CREATE_MISSING`) then it is possible for typechange/rename modifications to leave it unable to complete the request. That's okay, but the existing code did not have enough information not to generate an error (at least for tree/blob conflicts).

This led me down a long reworking of existing code. First, there is a commit with some extensions and reworking of the existing `rmdir` and `mkdir` utilities in `fileops.c`. Second comes another significant reorganization of the `checkout` code to handle the failing case, but fortunately that has some benefits:

1. The test case is handled correctly.
2. The new code should actually be much faster than the old code since I decided to make checkout aware of diff list internals.
3. The progress value accuracy is hugely increased since I added a fourth pass which calculates exactly what work needs to be done before doing anything.

I expect that folks may look at this PR and dislike it. Particularly, allowing checkout to understand diff internals is probably questionable, but it should really help with performance and it allowed me to directly use the index into the `git_vector` of deltas to build a parallel vector of actions which is pretty convenient.