From 36abb399b3ce7659fddbdc556ca3157db7da4f51 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 16 Nov 2024 23:51:05 +0100 Subject: [PATCH] #3327: update-assemblyinfo.ps1: Redirect stderr for commands that should ignore errors. --- BuildTools/update-assemblyinfo.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BuildTools/update-assemblyinfo.ps1 b/BuildTools/update-assemblyinfo.ps1 index f4096cb746..143ba21657 100644 --- a/BuildTools/update-assemblyinfo.ps1 +++ b/BuildTools/update-assemblyinfo.ps1 @@ -52,8 +52,9 @@ function gitVersion() { return 0; } try { - return [Int32]::Parse((git rev-list --count "$baseCommit..HEAD")) + $baseCommitRev; + return [Int32]::Parse((git rev-list --count "$baseCommit..HEAD" 2>&1 | Tee-Object -Variable cmdOutput)) + $baseCommitRev; } catch { + Write-Host $cmdOutput return 0; } } @@ -63,8 +64,9 @@ function gitCommitHash() { return "0000000000000000000000000000000000000000"; } try { - return (git rev-list --max-count 1 HEAD); + return (git rev-list --max-count 1 HEAD 2>&1 | Tee-Object -Variable cmdOutput); } catch { + Write-Host $cmdOutput return "0000000000000000000000000000000000000000"; } } @@ -74,8 +76,9 @@ function gitShortCommitHash() { return "00000000"; } try { - return (git rev-parse --short=8 (git rev-list --max-count 1 HEAD)); + return (git rev-parse --short=8 (git rev-list --max-count 1 HEAD 2>&1 | Tee-Object -Variable cmdOutput) 2>&1 | Tee-Object -Variable cmdOutput); } catch { + Write-Host $cmdOutput return "00000000"; } }