]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Ignore non-plaintext changes in cover
authorvrana <jakubv@fb.com>
Wed, 4 Jan 2012 23:22:17 +0000 (15:22 -0800)
committervrana <jakubv@fb.com>
Wed, 4 Jan 2012 23:44:48 +0000 (15:44 -0800)
Test Plan:
Run ##arc lint## after changing a binary file
"Warning:  Invalid argument supplied for foreach() in
src/workflow/cover/ArcanistCoverWorkflow.php on line 88" should not be displayed

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1314

src/workflow/cover/ArcanistCoverWorkflow.php

index 639c7921f59d0b82f7d8688fbb17717a23725dae..44d5792fcb16b4b7617da85848ce32d81b289ce1 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 /*
- * Copyright 2011 Facebook, Inc.
+ * Copyright 2012 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -75,15 +75,13 @@ EOTEXT
         "You're covered, you didn't change anything.");
     }
 
-    $changed = array();
-    foreach ($paths as $path) {
-      $changed[$path] = $this->getChangedLines($path, 'cover');
-    }
-
     $covers = array();
     foreach ($paths as $path) {
+      $lines = $this->getChangedLines($path, 'cover');
+      if (!$lines) {
+        continue;
+      }
       $blame = $repository_api->getBlame($path);
-      $lines = $changed[$path];
       foreach ($lines as $line) {
         list($author, $revision) = idx($blame, $line, array(null, null));
         if (!$author) {