Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15417762
D18541.id44524.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D18541.id44524.diff
View Options
diff --git a/src/lint/renderer/ArcanistConsoleLintRenderer.php b/src/lint/renderer/ArcanistConsoleLintRenderer.php
--- a/src/lint/renderer/ArcanistConsoleLintRenderer.php
+++ b/src/lint/renderer/ArcanistConsoleLintRenderer.php
@@ -171,13 +171,10 @@
$old_impact--;
$new_impact--;
- if ($old_impact < 0 || $new_impact < 0) {
- throw new Exception(
- pht(
- 'Modified suffix line range has become negative '.
- '(old = %d, new = %d).',
- $old_impact,
- $new_impact));
+ // We can end up here if a patch removes a line which occurs after
+ // another identical line.
+ if ($old_impact <= 0 || $new_impact <= 0) {
+ break;
}
} while (true);
diff --git a/src/lint/renderer/__tests__/ArcanistConsoleLintRendererTestCase.php b/src/lint/renderer/__tests__/ArcanistConsoleLintRendererTestCase.php
--- a/src/lint/renderer/__tests__/ArcanistConsoleLintRendererTestCase.php
+++ b/src/lint/renderer/__tests__/ArcanistConsoleLintRendererTestCase.php
@@ -19,6 +19,23 @@
import dog;
EOTEXT;
+ $remline_original = <<<EOTEXT
+import apple;
+import banana;
+
+
+import cat;
+import dog;
+EOTEXT;
+
+ $remline_replacement = <<<EOTEXT
+import apple;
+import banana;
+
+import cat;
+import dog;
+EOTEXT;
+
$map = array(
'simple' => array(
'line' => 1,
@@ -89,6 +106,13 @@
'original' => $midline_original,
'replacement' => $midline_replacement,
),
+
+ 'remline' => array(
+ 'line' => 1,
+ 'char' => 1,
+ 'original' => $remline_original,
+ 'replacement' => $remline_replacement,
+ ),
);
$defaults = array(
diff --git a/src/lint/renderer/__tests__/data/remline.expect b/src/lint/renderer/__tests__/data/remline.expect
new file mode 100644
--- /dev/null
+++ b/src/lint/renderer/__tests__/data/remline.expect
@@ -0,0 +1,12 @@
+>>> Lint for path/to/example.c:
+
+
+ Warning (WARN123) Lint Warning
+ Consider this.
+
+ 1 import apple;
+ 2 import banana;
+ 3 ~
+ >>> - 4 ~
+ 5 import cat;
+ 6 import dog;
diff --git a/src/lint/renderer/__tests__/data/remline.txt b/src/lint/renderer/__tests__/data/remline.txt
new file mode 100644
--- /dev/null
+++ b/src/lint/renderer/__tests__/data/remline.txt
@@ -0,0 +1,6 @@
+import apple;
+import banana;
+
+
+import cat;
+import dog;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 21, 6:17 PM (2 w, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7715859
Default Alt Text
D18541.id44524.diff (2 KB)
Attached To
Mode
D18541: Fix a similar lint rendering issue when trimming identical lines out of patches
Attached
Detach File
Event Timeline
Log In to Comment