1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-22 20:51:10 +01:00

When building a synthetic diff in Differential, adjust diff properties correctly

Summary:
See PHI1218. When rendering "A vs B", we currently show the properties of diff A without modification.

Instead, take properties from the same place we're taking change details.

See T12664 for a followup.

Test Plan:
  - In diff A, removed "+x" from a file.
  - In diff B, changed the file but did not remove "+x" from it.
  - Diffed B vs A.
    - Before change: UI incorrectly shows "+x" removed (both sides incorrect, just showing the change from diff A).
    - After change: UI shows 100644 -> null, which is half right.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20478
This commit is contained in:
epriestley 2019-04-25 15:06:26 -07:00
parent 0d9362355b
commit 6eae75d8f2

View file

@ -110,10 +110,13 @@ final class DifferentialChangesetViewController extends DifferentialController {
if ($left) {
$left_data = $left->makeNewFile();
$left_properties = $left->getNewProperties();
if ($right) {
$right_data = $right->makeNewFile();
$right_properties = $right->getNewProperties();
} else {
$right_data = $left->makeOldFile();
$right_properties = $left->getOldProperties();
}
$engine = new PhabricatorDifferenceEngine();
@ -124,6 +127,9 @@ final class DifferentialChangesetViewController extends DifferentialController {
$choice = clone nonempty($left, $right);
$choice->attachHunks($synthetic->getHunks());
$choice->setOldProperties($left_properties);
$choice->setNewProperties($right_properties);
$changeset = $choice;
}