1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

In 1-up source diffs, retain the "No newline at end of file" on "\" lines

Summary:
See PHI1839. Currently, the "No newline at end of file" text is dropped in the 1-up diff view for changes that affect a file with no trailing newline.

Track it through the construction of diff primitivies more carefully.

Test Plan: {F7695760}

Differential Revision: https://secure.phabricator.com/D21433
This commit is contained in:
epriestley 2020-08-05 09:46:51 -07:00
parent c1eeacd850
commit 98e0440d45
2 changed files with 10 additions and 2 deletions

View file

@ -83,7 +83,9 @@ final class DifferentialChangesetOneUpRenderer
$cells = array(); $cells = array();
if ($is_old) { if ($is_old) {
if ($p['htype']) { if ($p['htype']) {
if (empty($p['oline'])) { if ($p['htype'] === '\\') {
$class = 'comment';
} else if (empty($p['oline'])) {
$class = 'left old old-full'; $class = 'left old old-full';
} else { } else {
$class = 'left old'; $class = 'left old';
@ -129,7 +131,9 @@ final class DifferentialChangesetOneUpRenderer
$cells[] = $no_coverage; $cells[] = $no_coverage;
} else { } else {
if ($p['htype']) { if ($p['htype']) {
if (empty($p['oline'])) { if ($p['htype'] === '\\') {
$class = 'comment';
} else if (empty($p['oline'])) {
$class = 'right new new-full'; $class = 'right new new-full';
} else { } else {
$class = 'right new'; $class = 'right new';

View file

@ -505,6 +505,8 @@ abstract class DifferentialChangesetRenderer extends Phobject {
$ospec['htype'] = $old[$ii]['type']; $ospec['htype'] = $old[$ii]['type'];
if (isset($old_render[$ii])) { if (isset($old_render[$ii])) {
$ospec['render'] = $old_render[$ii]; $ospec['render'] = $old_render[$ii];
} else if ($ospec['htype'] === '\\') {
$ospec['render'] = $old[$ii]['text'];
} }
} }
@ -514,6 +516,8 @@ abstract class DifferentialChangesetRenderer extends Phobject {
$nspec['htype'] = $new[$ii]['type']; $nspec['htype'] = $new[$ii]['type'];
if (isset($new_render[$ii])) { if (isset($new_render[$ii])) {
$nspec['render'] = $new_render[$ii]; $nspec['render'] = $new_render[$ii];
} else if ($nspec['htype'] === '\\') {
$nspec['render'] = $new[$ii]['text'];
} }
} }