It seems a common case for mangled patches is editors or MUAs
dropping trailing whitespace, and lines matching /^ $/ gets
the space dropped to only match /^$/.
if ($s =~ /^---$/) {
to_state($dst, $state, DSTATE_STAT);
$$dst .= $s;
- } elsif ($s =~ /^ /) {
+ } elsif ($s =~ /^ / || ($s =~ /^$/ && $state >= DSTATE_CTX)) {
# works for common cases, but not weird/long filenames
if ($state == DSTATE_STAT &&
$s =~ /^ (.+)( +\| .*\z)/s) {