mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-08 01:14:34 +02:00
Ensure that git head is really a file (and not a dir)
This commit is contained in:
parent
95d06504ab
commit
1a0e07fbaf
1 changed files with 2 additions and 2 deletions
|
@ -60,7 +60,7 @@ class GitVersionInfo
|
||||||
*/
|
*/
|
||||||
public function getGitBranchName()
|
public function getGitBranchName()
|
||||||
{
|
{
|
||||||
if (file_exists($this->project_dir.'/.git/HEAD')) {
|
if (is_file($this->project_dir.'/.git/HEAD')) {
|
||||||
$git = file($this->project_dir.'/.git/HEAD');
|
$git = file($this->project_dir.'/.git/HEAD');
|
||||||
$head = explode('/', $git[0], 3);
|
$head = explode('/', $git[0], 3);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class GitVersionInfo
|
||||||
public function getGitCommitHash(int $length = 7)
|
public function getGitCommitHash(int $length = 7)
|
||||||
{
|
{
|
||||||
$filename = $this->project_dir.'/.git/refs/remotes/origin/'.$this->getGitBranchName();
|
$filename = $this->project_dir.'/.git/refs/remotes/origin/'.$this->getGitBranchName();
|
||||||
if (file_exists($filename)) {
|
if (is_file($filename)) {
|
||||||
$head = file($filename);
|
$head = file($filename);
|
||||||
|
|
||||||
if (! isset($head[0])) {
|
if (! isset($head[0])) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue