From f4b48d9c20aa7db82ac28f6593ad1f44780ce481 Mon Sep 17 00:00:00 2001 From: Marius Mutu Date: Mon, 3 Aug 2026 18:23:41 +0300 Subject: [PATCH] =?UTF-8?q?=EF=BB=BFlivrare.ps1:=20mesajul=20de=20commit?= =?UTF-8?q?=20prin=20fisier,=20nu=20prin=20-m?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PowerShell 5.1 nu escapeaza argumentele catre exe native, deci ghilimele duble in mesaj (ex. un commit de "sync SVN") spargeau apelul git. Mesajul se scrie intr-un fisier temporar si se foloseste git commit -F, sters in finally. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_014sNn6dmAimtyXkDU4frJrh --- utile/livrare.ps1 | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/utile/livrare.ps1 b/utile/livrare.ps1 index 7fbe75b..09fc046 100644 --- a/utile/livrare.ps1 +++ b/utile/livrare.ps1 @@ -349,7 +349,7 @@ function Invoke-PushCuRebaseRetry($repoPath, $eticheta) { return 0 } -function Comite-Si-Impinge($repoPath, $eticheta, $faraPush) { +function Comite-Si-Impinge($repoPath, $eticheta, $faraPush, $mesajFile) { # mesajele folosesc Write-Host (nu Write-Output): functia e apelata cu rezultatul # capturat intr-o variabila, iar Write-Output ar ajunge in valoarea returnata. if (-not (Test-Path (Join-Path $repoPath '.git'))) { @@ -363,7 +363,9 @@ function Comite-Si-Impinge($repoPath, $eticheta, $faraPush) { return 0 } $ramura = (& git -C $repoPath rev-parse --abbrev-ref HEAD) - & git -C $repoPath commit -m $Mesaj | Out-Null + # -F , nu -m $Mesaj: PowerShell 5.1 nu escapeaza ghilimele/backtick/$ cand paseaza + # argumente catre un exe nativ - un mesaj cu ghilimele duble ("sync SVN") sparge -m $Mesaj. + & git -C $repoPath commit -F $mesajFile | Out-Null if ($LASTEXITCODE -ne 0) { Write-Host ('[5] ' + $eticheta + ': COMMIT ESUAT pe ramura ' + $ramura) return 1 @@ -376,12 +378,25 @@ function Comite-Si-Impinge($repoPath, $eticheta, $faraPush) { return (Invoke-PushCuRebaseRetry $repoPath $eticheta) } -$exitCode += (Comite-Si-Impinge $ProjectRoot 'proiect' $FaraPush) +# mesajul de commit trece printr-un fisier temporar (nu ca argument -m): singurul mod sigur +# de a duce prin PowerShell->exe nativ un text cu ghilimele/backtick/$/linii multiple/"-" la +# inceput de linie fara sa fie interpretat sau trunchiat. Sters mereu, inclusiv pe esec. +$mesajDir = $null +try { + $mesajDir = Join-Path ([System.IO.Path]::GetTempPath()) ('livrare_' + [guid]::NewGuid().ToString('N')) + New-Item -ItemType Directory -Path $mesajDir | Out-Null + $mesajFile = Join-Path $mesajDir 'mesaj_commit.txt' + $Mesaj | Out-File -FilePath $mesajFile -Encoding utf8 -if ($Comun) { - $exitCode += (Comite-Si-Impinge $comunPath 'COMUN' $FaraPush) -} elseif ($modifComun.Count -gt 0) { - Write-Output ('[5] COMUN: ' + $modifComun.Count + ' fisiere necomise - nu se comite fara -Comun') + $exitCode += (Comite-Si-Impinge $ProjectRoot 'proiect' $FaraPush $mesajFile) + + if ($Comun) { + $exitCode += (Comite-Si-Impinge $comunPath 'COMUN' $FaraPush $mesajFile) + } elseif ($modifComun.Count -gt 0) { + Write-Output ('[5] COMUN: ' + $modifComun.Count + ' fisiere necomise - nu se comite fara -Comun') + } +} finally { + if ($mesajDir -and (Test-Path $mesajDir)) { Remove-Item -LiteralPath $mesajDir -Recurse -Force -ErrorAction SilentlyContinue } } if ($exitCode -gt 0) { exit 3 }