return $line_map;
}
- public function convertToBinaryChange() {
+ public function convertToBinaryChange(ArcanistRepositoryAPI $api) {
+
+ // Fill in the binary data from the working copy.
+
+ $this->setOriginalFileData(
+ $api->getOriginalFileData(
+ $this->getOldPath()));
+
+ $this->setCurrentFileData(
+ $api->getCurrentFileData(
+ $this->getCurrentPath()));
+
$this->hunks = array();
$this->setFileType(ArcanistDiffChangeType::FILE_BINARY);
return $this;
"{$byte_warning} If the file is not a text file, you can ".
"mark it 'binary'. Mark this file as 'binary' and continue?";
if (phutil_console_confirm($confirm)) {
- $change->convertToBinaryChange();
+ $change->convertToBinaryChange($repository_api);
} else {
throw new ArcanistUsageException(
"Aborted generation of gigantic diff.");
throw new ArcanistUsageException("Aborted workflow to fix UTF-8.");
} else {
foreach ($utf8_problems as $change) {
- $change->convertToBinaryChange();
+ $change->convertToBinaryChange($repository_api);
}
}
}
$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 it. (This is distinct from an empty file, which we
- // do upload.)
+ // need to upload the other half of it (e.g., the old file data for
+ // a file which was just added). This is distinct from an empty
+ // file, which we do upload.
unset($need_upload[$key]);
continue;
}