1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-10 00:42:40 +01:00

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
This commit is contained in:
Aviv Eyal 2016-06-06 20:51:16 +00:00 committed by avivey
parent 7891df6f25
commit ca33240942

View file

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