Fix various newline problems in the difference engines
Summary: I'll mark this one up inline since it's all separate bugs. Test Plan: - Created a diff with eight changes: (newline absent -> newline present, newline present -> newline absent, newline present -> newline present, newline absent -> newline absent) x (short file with change near end, long file with change near middle). - Viewed diff in Ignore All, Ignore Most, Ignore Trailing and Show All whitespace modes. - All 32 results seemed sensible. - Really wish this stuff was better factored and testable. Need to fix it. :( Reviewers: vrana, btrahan Reviewed By: btrahan CC: aran, epriestley Maniphest Tasks: T1030 Differential Revision: https://secure.phabricator.com/D1992
This commit is contained in:
@@ -228,7 +228,7 @@ final class DifferentialChangesetParser {
|
||||
'text' => (string)substr($lines[$cursor], 1),
|
||||
'line' => $new_line,
|
||||
);
|
||||
if ($type == '\\' && $cursor > 1) {
|
||||
if ($type == '\\') {
|
||||
$type = $types[$cursor - 1];
|
||||
$data['text'] = ltrim($data['text']);
|
||||
}
|
||||
@@ -338,9 +338,14 @@ final class DifferentialChangesetParser {
|
||||
break;
|
||||
}
|
||||
if ($similar) {
|
||||
$o_desc['type'] = null;
|
||||
$n_desc['type'] = null;
|
||||
$skip_intra[count($old)] = true;
|
||||
if ($o_desc['type'] == '\\') {
|
||||
// These are similar because they're "No newline at end of file"
|
||||
// comments.
|
||||
} else {
|
||||
$o_desc['type'] = null;
|
||||
$n_desc['type'] = null;
|
||||
$skip_intra[count($old)] = true;
|
||||
}
|
||||
} else {
|
||||
$changed = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user