Index tree-bob collision

Here's @arrbee's test and my proposed fix, which is ported verbatim from Git and doesn't quite work. We're now getting a couple errors about collisions from merge. @ethomson, could you please give this a look?

I am not too excited about this because the fix has been backported quite haphazardly from Core Git. It seems we're doing a lot of things poorly in our index implementation... I am strongly considering scratching it and porting it verbatim from Core Git, as we have licensing permission for most of the code in that file. The Index is one of the oldest parts of libgit2 and it's starting to show its age. Any feedback?