Merge pull request #67 from attiks/i64b

check if file exists before reading to avoid warnings
This commit is contained in:
Klaus Silveira
2012-06-28 10:35:15 -07:00

View File

@@ -413,9 +413,14 @@ class Repository
*/
public function getHead()
{
$file = file_get_contents($this->getPath() . '/.git/HEAD');
if ($file === FALSE) {
$file = file_get_contents($this->getPath() . '/HEAD');
if (file_exists($this->getPath() . '/.git/HEAD')) {
$file = @file_get_contents($this->getPath() . '/.git/HEAD');
}
else if (file_exists($this->getPath() . '/HEAD')) {
$file = @file_get_contents($this->getPath() . '/HEAD');
}
else {
return 'master';
}
foreach (explode("\n", $file) as $line) {
$m = array();