From: Aviv Eyal Date: Mon, 6 Jun 2016 20:51:16 +0000 (+0000) Subject: Don't specify size 0 for deleted files X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=ca33240942597932075f8e715628b36eebbe68ce;p=arcanist.git Don't specify size 0 for deleted files 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 --- diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php index 40a179f1..3a631e88 100644 --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -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);