1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Fix an intradiff error when the newer changeset does not exist

Summary: Ref T13523. If a file hasn't been touched in the newer changeset, we can currently hit an error in the interdiff.

Test Plan:
  - Touched "moo.txt" in Diff 1.
  - Reverted the changes to "moo.txt" in Diff 2.
  - Diffed 2 vs 1.
  - Before patch: fatal (call to getFilename() on null).
  - After patch: clean interdiff.

Maniphest Tasks: T13523

Differential Revision: https://secure.phabricator.com/D21220
This commit is contained in:
epriestley 2020-05-04 15:34:27 -07:00
parent 07e160bde1
commit 6430d6d638

View file

@ -560,12 +560,16 @@ final class DifferentialChangeset
$right_state = $right->hasNewState();
$shared_metadata = $right->getMetadata();
$right_type = $right->getNewFileType();
$file_name = $right->getFilename();
} else {
$right_data = $left->makeOldFile();
$right_properties = $left->getOldProperties();
$right_metadata = $left->getOldStateMetadata();
$right_state = $left->hasOldState();
$right_type = $left->getOldFileType();
$file_name = $left->getFilename();
}
$engine = new PhabricatorDifferenceEngine();
@ -578,7 +582,7 @@ final class DifferentialChangeset
->makeEphemeral(true)
->attachDiff($left->getDiff())
->setOldFile($left->getFilename())
->setFilename($right->getFilename());
->setFilename($file_name);
// TODO: Change type?
// TODO: Away paths?