From 656c82f9b86b5e986947798e7a0f5c2712315493 Mon Sep 17 00:00:00 2001 From: vrana Date: Mon, 18 Jun 2012 12:48:05 -0700 Subject: [PATCH] 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 --- src/applications/differential/storage/DifferentialChangeset.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/differential/storage/DifferentialChangeset.php b/src/applications/differential/storage/DifferentialChangeset.php index 34c884424a..4755abd4c7 100644 --- a/src/applications/differential/storage/DifferentialChangeset.php +++ b/src/applications/differential/storage/DifferentialChangeset.php @@ -142,7 +142,7 @@ final class DifferentialChangeset extends DifferentialDAO { $changes = explode("\n", $hunk->getChanges()); foreach ($changes as $l => $line) { 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);