libgit2/libgit2 — pull request #1445 by ethomson (2013-03-29 16:38:47+00:00)
Title: remove unmerged files during reset hard

Treat an index entry at any stage as if it were staged, in order to clean up working directory items that result from an aborted merge.

Consider that we delete some file `file` in our branch `master` and merge in branch `branch` that contains an edit to the file `file`. We will be left with an index:

100644 27b89ab611e391e6707207e6b9136407bee499a5 1 file
100644 5fbd29033b82cc8d8cc9bb9cd836dc756630fb19 3 file

And `file` will be recreated in the workdir from the contents in `branch`.

`git reset --hard` will remove `file` when resetting. libgit2 should do the same.

(Note that core git cleans up working directory contents for unmerged files always - it does not check that the workdir contents match one of the sides in the index. Our tests ensures that behavior is consistent.)