public function getRawObjectForSha($sha)
{
if ($this->index) {
$offset = $this->index->getPackfileOffsetForSha($sha);
$raw_object = $this->getRawObjectAtOffset($offset);
// SHA string comparison has to be with ===
if (!$raw_object->getSha() === $sha) {
throw new InvalidPackfileException(sprintf("Unexpected RawObject sha, expected %s, was %s", $sha, $raw_object->getSha()));
}
return $raw_object;
} else {
throw new \BadMethodCallException("getRawObjectForSha without index is not implemented yet.");
}
}