Fix update launcher empty path

This commit is contained in:
michele 2026-04-08 22:10:04 +00:00
parent f06a0ce737
commit e0e2724db4

View File

@ -1218,36 +1218,28 @@ private function loadDevelopmentSnapshot(): void
private function loadFunctionalHighlights(): void
{
$repoPath = $this->resolveGitWorkspacePath();
$this->gitWorkspacePath = $repoPath;
$this->gitCurrentBranch = $this->runGitProcessAt($repoPath, ['rev-parse', '--abbrev-ref', 'HEAD']);
$this->gitCurrentCommit = $this->runGitProcessAt($repoPath, ['rev-parse', '--short', 'HEAD']);
$this->gitCurrentCommitDate = $this->runGitProcessAt($repoPath, ['show', '-s', '--date=format:%d/%m/%Y %H:%M', '--format=%cd', 'HEAD']);
$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']) ?? '')) !== '';
$this->functionalHighlights = [];
$path = base_path('docs/NETGESCON-MODIFICHE.md');
if (! is_file($path)) {
return;
}
$lines = preg_split('/\r\n|\r|\n/', (string) @file_get_contents($path)) ?: [];
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 === '') {
continue;
}
if (! str_starts_with($line, '-')) {
$this->gitAheadBehind = $repoPath === null ? 'non disponibile' : '-';
continue;
}
if (! str_contains($line, '[U]') && ! str_contains($line, '[P]')) {
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, '- '));
if (count($this->functionalHighlights) >= 30) {
break;