Ticket #2930: 2930_patchfs.in.diff

File 2930_patchfs.in.diff, 1.1 KB (added by andrew_b, 11 years ago)

Preliminary patch

  • patchfs.in

     
    273273            } 
    274274            print $fh $_ if($rmmod != $filefound); 
    275275            $fsize+=length; 
    276             my ($first)= /^(.)/; 
    277             if(ord($first) == ord('+')) { $h_add++; } 
    278             elsif(ord($first) == ord('-')) { $h_del++; } 
    279             elsif(ord($first) == ord(' ')) { $h_ctx++; } 
    280             elsif(ord($first) == ord('\\')) { 0; } 
    281             elsif(ord($first) == ord('@')) { error "Malformed hunk, header came too early"; } 
    282             else { error "Unrecognized character in hunk"; } 
     276            if (/^$/) { 
     277                # Empty line, but should start with ' '. Diff is incorrect, but try to parse it anyway. 
     278                $h_ctx++; 
     279            } else { 
     280                my ($first)= /^(.)/; 
     281                if(ord($first) == ord('+')) { $h_add++; } 
     282                elsif(ord($first) == ord('-')) { $h_del++; } 
     283                elsif(ord($first) == ord(' ')) { $h_ctx++; } 
     284                elsif(ord($first) == ord('\\')) { 0; } 
     285                elsif(ord($first) == ord('@')) { error "Malformed hunk, header came too early"; } 
     286                else { error "Unrecognized character in hunk"; } 
     287            } 
    283288        } 
    284289    } 
    285290    if($file eq '' && $filetoprint) {