Fix collapsing of unmerged entries in the status view
commit230d8d63540fe9041932e0ea24de629dbe8cf907
authorJonas Fonseca <jonas.fonseca@gmail.com>
Fri, 25 Apr 2014 23:52:50 +0000 (25 19:52 -0400)
committerJonas Fonseca <jonas.fonseca@gmail.com>
Fri, 25 Apr 2014 23:52:50 +0000 (25 19:52 -0400)
tree63e831d69440c3efbc3a426b000f042e3857cd6b
parent26fc729d25ab308984622bb643161aae01765697
Fix collapsing of unmerged entries in the status view

The unstaged entries in the status view is read using git-diff-files,
which reports conflicting git index entries using two lines, e.g.:

    :000000 100644 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 U NEWS.adoc
    :100644 100644 3c49864fe2ec26a160c6e95f21c5b2fe96d4e615 0000000000000000000000000000000000000000 M NEWS.adoc

The code reading this raw diff output would collapse any line with the
'U' status with the one that followed it. However, for certain conflicts
the unmerged entries are not followed by a "merged" entry, e.g. when
cherry picking a commit depending on files added previously in the
branch; what `git-status --porcelain` reports as "unmerged, deleted by
us":

    DU include/tig/search.h
    DU src/search.c

The git-diff-files output for such an index is two consecutive unmerged
entries:

    :000000 100644 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 U include/tig/search.h
    :000000 100644 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 U src/search.c

Change status_run to first parse each raw diff line and then only
collapse previous unmerged entries where the file name matches.
src/status.c