git: Properly show changes for files in both the working tree and index, with tests

We used to always show a file once and only once in the status view, but it is
valid for git to show modifications for the same file in both the working tree
and index. Unit tests are included to verify that we are parsing status
information correctly for these cases.