Fix update launcher empty path
This commit is contained in:
parent
f06a0ce737
commit
e0e2724db4
|
|
@ -1218,36 +1218,28 @@ private function loadDevelopmentSnapshot(): void
|
||||||
|
|
||||||
private function loadFunctionalHighlights(): void
|
private function loadFunctionalHighlights(): void
|
||||||
{
|
{
|
||||||
$repoPath = $this->resolveGitWorkspacePath();
|
$this->functionalHighlights = [];
|
||||||
$this->gitWorkspacePath = $repoPath;
|
|
||||||
$this->gitCurrentBranch = $this->runGitProcessAt($repoPath, ['rev-parse', '--abbrev-ref', 'HEAD']);
|
$path = base_path('docs/NETGESCON-MODIFICHE.md');
|
||||||
$this->gitCurrentCommit = $this->runGitProcessAt($repoPath, ['rev-parse', '--short', 'HEAD']);
|
if (! is_file($path)) {
|
||||||
$this->gitCurrentCommitDate = $this->runGitProcessAt($repoPath, ['show', '-s', '--date=format:%d/%m/%Y %H:%M', '--format=%cd', 'HEAD']);
|
return;
|
||||||
$this->gitRemoteCommit = $this->runGitProcessAt($repoPath, ['rev-parse', '--short', 'refs/remotes/' . $this->gitRemote . '/' . $this->gitBranch]);
|
}
|
||||||
$this->gitRemoteCommitDate = $this->runGitProcessAt($repoPath, ['show', '-s', '--date=format:%d/%m/%Y %H:%M', '--format=%cd', 'refs/remotes/' . $this->gitRemote . '/' . $this->gitBranch]);
|
|
||||||
$this->gitWorkingTreeDirty = trim((string) ($this->runGitProcessAt($repoPath, ['status', '--porcelain']) ?? '')) !== '';
|
|
||||||
|
|
||||||
$lines = preg_split('/\r\n|\r|\n/', (string) @file_get_contents($path)) ?: [];
|
$lines = preg_split('/\r\n|\r|\n/', (string) @file_get_contents($path)) ?: [];
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
$aheadBehind = $this->runGitProcessAt($repoPath, ['rev-list', '--left-right', '--count', 'HEAD...refs/remotes/' . $this->gitRemote . '/' . $this->gitBranch]);
|
$line = trim((string) $line);
|
||||||
if ($line === '') {
|
if ($line === '') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! str_starts_with($line, '-')) {
|
if (! str_starts_with($line, '-')) {
|
||||||
$this->gitAheadBehind = $repoPath === null ? 'non disponibile' : '-';
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! str_contains($line, '[U]') && ! str_contains($line, '[P]')) {
|
if (! str_contains($line, '[U]') && ! str_contains($line, '[P]')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->gitCurrentBranch = $this->gitCurrentBranch ?: (isset($summary['branch']) ? (string) $summary['branch'] : null);
|
|
||||||
$this->gitCurrentCommit = $this->gitCurrentCommit ?: (isset($summary['after_commit']) ? (string) $summary['after_commit'] : (isset($summary['before_commit']) ? (string) $summary['before_commit'] : null));
|
|
||||||
$this->gitRemoteCommit = $this->gitRemoteCommit ?: (isset($summary['remote_commit']) ? (string) $summary['remote_commit'] : $this->gitCurrentCommit);
|
|
||||||
$syncDate = isset($summary['synced_at']) ? (string) $summary['synced_at'] : null;
|
|
||||||
$this->gitCurrentCommitDate = $this->gitCurrentCommitDate ?: $syncDate;
|
|
||||||
$this->gitRemoteCommitDate = $this->gitRemoteCommitDate ?: $syncDate;
|
|
||||||
$this->functionalHighlights[] = trim(ltrim($line, '- '));
|
$this->functionalHighlights[] = trim(ltrim($line, '- '));
|
||||||
if (count($this->functionalHighlights) >= 30) {
|
if (count($this->functionalHighlights) >= 30) {
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user