]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Don't specify size 0 for deleted files
authorAviv Eyal <avivey@gmail.com>
Mon, 6 Jun 2016 20:51:16 +0000 (20:51 +0000)
committeravivey <autocommitter@example.com>
Mon, 6 Jun 2016 20:51:16 +0000 (20:51 +0000)
Summary: See D15828 - arc is reporting file size as `0` for unexisting files - make it stop.

Test Plan: `arc diff` with empty, deleted, added files - see size reported as `null` when appropriate.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: chad, Korvin

Differential Revision: https://secure.phabricator.com/D16059

src/workflow/ArcanistDiffWorkflow.php

index 40a179f14be41d3aaac03e577b0d15a49df63172..3a631e88b4c4bfa0e4eb9b458fd38aa1998c774d 100644 (file)
@@ -2591,10 +2591,6 @@ EOTEXT
     foreach ($need_upload as $key => $spec) {
       $change = $need_upload[$key]['change'];
 
-      $type = $spec['type'];
-      $size = strlen($spec['data']);
-
-      $change->setMetadata("{$type}:file:size", $size);
       if ($spec['data'] === null) {
         // This covers the case where a file was added or removed; we don't
         // need to upload the other half of it (e.g., the old file data for
@@ -2604,6 +2600,11 @@ EOTEXT
         continue;
       }
 
+      $type = $spec['type'];
+      $size = strlen($spec['data']);
+
+      $change->setMetadata("{$type}:file:size", $size);
+
       $mime = $this->getFileMimeType($spec['data']);
       if (preg_match('@^image/@', $mime)) {
         $change->setFileType($type_image);