read_index_unmerged doesn't loop forever if merged stage exists for unmerged file

Signed-off-by: Jaime Soriano Pastor <jsorianopastor@gmail.com>
Error out when adding a file with merged and unmerged entries

Signed-off-by: Jaime Soriano Pastor <jsorianopastor@gmail.com>
Added tests for the case of merged and unmerged entries for the same file

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