1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42:41 +01:00

Correct a case where a single-hunk diff may incorrectly be identified as multi-hunk by the Scope engine

Summary: See PHI985. The layers above this may return `array()` to mean "one hunk with a line-1 offset". Accept either `array()` or `array(1 => ...)` to engage the scope engine.

Test Plan: See PHI985.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20363
This commit is contained in:
epriestley 2019-04-01 10:38:25 -07:00
parent 00b1c4190c
commit cddbe306f9

View file

@ -684,7 +684,12 @@ abstract class DifferentialChangesetRenderer extends Phobject {
// If this change is missing context, don't try to identify scopes, since
// we won't really be able to get anywhere.
$has_multiple_hunks = (count($hunk_starts) > 1);
$has_offset_hunks = (head_key($hunk_starts) != 1);
$has_offset_hunks = false;
if ($hunk_starts) {
$has_offset_hunks = (head_key($hunk_starts) != 1);
}
$missing_context = ($has_multiple_hunks || $has_offset_hunks);
if ($missing_context) {