Supporto Modifiche: usa worktree cache scrivibile
This commit is contained in:
parent
04ce45e0f1
commit
b0bdf1a020
|
|
@ -109,8 +109,7 @@ public function handle(): int
|
||||||
if ($deploySync) {
|
if ($deploySync) {
|
||||||
$this->writeProgress(32, 'Creazione sorgente remota pulita', 'running');
|
$this->writeProgress(32, 'Creazione sorgente remota pulita', 'running');
|
||||||
|
|
||||||
$worktreePath = storage_path('app/support/git-sync-worktrees/' . now()->format('YmdHis') . '-' . uniqid());
|
$worktreePath = $this->buildWorktreePath();
|
||||||
File::ensureDirectoryExists(dirname($worktreePath));
|
|
||||||
|
|
||||||
$worktreeAdd = Process::path($repoPath)
|
$worktreeAdd = Process::path($repoPath)
|
||||||
->timeout(1800)
|
->timeout(1800)
|
||||||
|
|
@ -361,6 +360,35 @@ private function resolveSourceRepositoryPath(): ?string
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function buildWorktreePath(): string
|
||||||
|
{
|
||||||
|
$baseDir = $this->resolveWorktreeBaseDir();
|
||||||
|
|
||||||
|
return $baseDir . '/' . now()->format('YmdHis') . '-' . uniqid();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function resolveWorktreeBaseDir(): string
|
||||||
|
{
|
||||||
|
$candidates = [
|
||||||
|
storage_path('framework/cache/git-sync-worktrees'),
|
||||||
|
storage_path('app/support/git-sync-worktrees'),
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($candidates as $candidate) {
|
||||||
|
if (! is_dir($candidate)) {
|
||||||
|
@mkdir($candidate, 0775, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_dir($candidate) && is_writable($candidate)) {
|
||||||
|
@chmod($candidate, 0775);
|
||||||
|
|
||||||
|
return $candidate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \RuntimeException('Nessuna directory worktree scrivibile disponibile per la sync Git.');
|
||||||
|
}
|
||||||
|
|
||||||
private function gitCommandArgs(string $path, array $arguments): array
|
private function gitCommandArgs(string $path, array $arguments): array
|
||||||
{
|
{
|
||||||
return array_merge(['git', '-c', 'safe.directory=' . $path], $arguments);
|
return array_merge(['git', '-c', 'safe.directory=' . $path], $arguments);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user