and that does not match the pattern in:
if line:match("^[12u]%s[MTADRCU%s%.%?!][MTDRCU%s%.%?!]%s") or line:match("^[%?!#]%s") then
so it falls through to the else which appends the unmatched line to the previous line.
The else statement is there to handle renamed files which end up on separate lines so I changed the for loop from a simple one-by-one loop to a loop that can look at the previous line. If the previous line is a "this file was renamed", i.e. matches: ^2 R., then append the current line, which contains the old file, to the previous line and move on.
The bug was that in a repo which has both a conflict and a renamed file
git status -z --porcelain=2 -b
will report:and that does not match the pattern in:
if line:match("^[12u]%s[MTADRCU%s%.%?!][MTDRCU%s%.%?!]%s") or line:match("^[%?!#]%s") then
so it falls through to the else which appends the unmatched line to the previous line.The else statement is there to handle renamed files which end up on separate lines so I changed the for loop from a simple one-by-one loop to a loop that can look at the previous line. If the previous line is a "this file was renamed", i.e. matches:
^2 R.
, then append the current line, which contains the old file, to the previous line and move on.This fixes #1176