mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 19:20:56 +01:00
Merge pull request #67 from attiks/i64b
check if file exists before reading to avoid warnings
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user