Fix leak in git_index_conflict_cleanup

I introduced a leak into conflict cleanup by removing items from
inside the git_vector_remove_matching call.  This simplifies the
code to just use one common way for the two conflict cleanup APIs.

When an index has an active snapshot, removing an item can cause
an error (inserting into the deferred deletion vector), so I made
the git_index_conflict_cleanup API return an error code.  I felt
like this wasn't so bad since it is just like the other APIs.

I fixed up a couple of comments while I was changing the header.
Minor tree cache speedups

While I was looking at the conflict cleanup code, I looked over at
the tree cache code, since we clear the tree cache for each entry
that gets removed and there is some redundancy there.  I made some
small tweaks to avoid extra calls to strchr and strlen in a few
circumstances.