git and hg diff views did not show empty context lines, a regression
from the commit(s) from issue 633. The diff parser assumed a properly formatted diff that denotes empty context lines with a single space in the first column. This single space however was missing, because the hg and git backends got the diff through PHP's exec() function and this returns already line-splitted output, but - and this is the actual problem - removes trailing whitespace at the end of each line, essentially making " \n" only "\n". When splitting this string now again with PREG_SPLIT_NO_EMPTY the empty line was completely lost in the diff output. To make it clear that an empty line does not mark a context line now, but should stop the diff parsing, the Diff parser now also defaults to 'false' as line type. This commit fixes issue 688.
This commit is contained in:
@@ -101,7 +101,7 @@ class IDF_Diff
|
||||
$files[$current_file]['chunks'][] = array();
|
||||
|
||||
while ($i < $diffsize && ($addlines >= 0 || $dellines >= 0)) {
|
||||
$linetype = $this->lines[$i] != '' ? $this->lines[$i][0] : ' ';
|
||||
$linetype = $this->lines[$i] != '' ? $this->lines[$i][0] : false;
|
||||
switch ($linetype) {
|
||||
case ' ':
|
||||
$files[$current_file]['chunks'][$current_chunk][] =
|
||||
|
Reference in New Issue
Block a user