Skip to content

Commit e072794

Browse files
author
Adrian Clay
committed
Make the type optional when parsing chunk lines.
git version 1.7.11.3 is generating a ```git diff``` where unchanged blank lines have no ```" "``` prefix.
1 parent 10a9cd9 commit e072794

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private function parseFileDiff(Diff $diff, array $lines)
110110
$last = null;
111111

112112
while (count($lines) &&
113-
(preg_match('(^(?P<type>[+ -])(?P<line>.*))', $last = array_shift($lines), $match) ||
113+
(preg_match('(^(?P<type>[+ -])?(?P<line>.*))', $last = array_shift($lines), $match) ||
114114
(strpos($last, '\\ No newline at end of file' ) === 0))) {
115115
if (count($match)) {
116116
$type = Line::UNCHANGED;

0 commit comments

Comments
 (0)