Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit ce0dc9a

Browse files
author
epriestley
committed
Correct an apparent off-by-one error when adjusting inlines across revision changes
Summary: See PHI1834. It's not obvious why this "+1" is present in the code, but it causes inlines to be adjusted incorrectly when a file is not modified across changes. See D21435. Remove it, which appears to produce accurate adjustment behavior. Test Plan: - See D21435 for instructions to build a change, where a file with lines "A-Z" is unmodified across Diff 1 and Diff 2. - Left inlines on lines 14, 17-19, and 16-26 (end of the file) on Diff 1. - Before: saw inlines incorrectly adjusted to lines 15, 18, and 17 on Diff 2. Before D21435, the last inline was culled by the rendering engine. - After: saw inlines correctly adjusted to lines 14, 17, and 16 (the same lines as the original), render properly, and highlight the correct lines when hovered. Differential Revision: https://secure.phabricator.com/D21436
1 parent dbdfac1 commit ce0dc9a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/infrastructure/diff/engine/PhabricatorInlineCommentAdjustmentEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public function execute() {
358358
list($tail_deleted, $tail_offset, $tail_line) = $tail_info;
359359

360360
if ($head_offset !== false) {
361-
$inline->setLineNumber($head_line + 1 + $head_offset);
361+
$inline->setLineNumber($head_line + $head_offset);
362362
} else {
363363
$inline->setLineNumber($head_line);
364364
$inline->setLineLength($tail_line - $head_line);

0 commit comments

Comments
 (0)