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

Fix principal error in makeChangesWithContext()

Summary: `array_fill()`, contrary to `range()`, doesn't accept the last element but the number of elements.

Test Plan: Reparsed commit not changed after the last diff but rebased which was previously reported as changed.

Reviewers: jungejason, epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D2783
This commit is contained in:
vrana 2012-06-18 12:48:05 -07:00
parent e84f9f9ec9
commit 656c82f9b8

View file

@ -142,7 +142,7 @@ final class DifferentialChangeset extends DifferentialDAO {
$changes = explode("\n", $hunk->getChanges()); $changes = explode("\n", $hunk->getChanges());
foreach ($changes as $l => $line) { foreach ($changes as $l => $line) {
if ($line[0] == '+' || $line[0] == '-') { if ($line[0] == '+' || $line[0] == '-') {
$context += array_fill($l - $num_lines, $l + $num_lines, true); $context += array_fill($l - $num_lines, 2 * $num_lines + 1, true);
} }
} }
$with_context[] = array_intersect_key($changes, $context); $with_context[] = array_intersect_key($changes, $context);