libgit2/libgit2 — pull request #2561 by jacquesg (2014-09-12 20:09:38+00:00)
Title: No files merged may result in bogus merge conflict error

So I found an interesting edge-case here: When cherry-picking a commit which has previously been applied and having untracked files in the working directory always resulted in a merge conflict error.

The reason for this is that even though we didn't merge any changes (they already exists in the index), we were passing 0 as the count parameter to ```git_diff_index_to_workdir```, resulting in all of the untracked files being reported as conflicted.

I've added a test case for this, the most natural place I found was using ```git_cherrypick``` as this is the most likely place you'll hit the problem.