read-cache.c: Ensure unmerged entries are removed

Wrong implementations of tools that modify the index can left
some files as merged and unmerged at the same time. Avoid undesiderable
behaviours by handling this situation.

Signed-off-by: Jaime Soriano Pastor <jsorianopastor@gmail.com>