mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-10 23:01:04 +01:00
Allow "arc upload" to work correctly if it can not hash content
Summary: Ref T12464. This is similar to D17619 and prepares us to move to SHA256 in the client. Note that it's fine if `arc` and Phabricator disagree about hashing algorithms. We don't really trust the client anyway, so if things are mismatched clients will just end up transferring a bit more data instead of getting to cheat when Phabricator already has copies of data. Test Plan: Ran `arc upload`, got a clean upload. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12464 Differential Revision: https://secure.phabricator.com/D17621
This commit is contained in:
parent
82b7cd778a
commit
c4e84550fc
1 changed files with 10 additions and 11 deletions
|
@ -222,15 +222,6 @@ final class ArcanistFileDataRef extends Phobject {
|
|||
$path));
|
||||
}
|
||||
|
||||
$hash = @sha1_file($path);
|
||||
if ($hash === false) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'Unable to upload file: failed to calculate file data hash for '.
|
||||
'path "%s".',
|
||||
$path));
|
||||
}
|
||||
|
||||
$size = @filesize($path);
|
||||
if ($size === false) {
|
||||
throw new Exception(
|
||||
|
@ -240,11 +231,11 @@ final class ArcanistFileDataRef extends Phobject {
|
|||
$path));
|
||||
}
|
||||
|
||||
$this->hash = $hash;
|
||||
$this->hash = $this->newFileHash($path);
|
||||
$this->size = $size;
|
||||
} else {
|
||||
$data = $this->data;
|
||||
$this->hash = sha1($data);
|
||||
$this->hash = $this->newDataHash($data);
|
||||
$this->size = strlen($data);
|
||||
}
|
||||
}
|
||||
|
@ -354,4 +345,12 @@ final class ArcanistFileDataRef extends Phobject {
|
|||
return $data;
|
||||
}
|
||||
|
||||
private function newFileHash($path) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private function newDataHash($data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue