From 82f8a40f0bf4e10b53eeb78c73032c6649d40ada Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 24 Mar 2023 11:15:43 -0700 Subject: [PATCH] Explicitly set PSNativeCommandArgumentPassing to Legacy for git push script (#35119) https://learn.microsoft.com/en-us/powershell/scripting/learn/experimental-features?view=powershell-7.3#psnativecommandargumentpassing Do to that breaking change in PS 7.3 we need to opt into the legacy arg parsing. Co-authored-by: Wes Haggard --- eng/common/scripts/git-branch-push.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/common/scripts/git-branch-push.ps1 b/eng/common/scripts/git-branch-push.ps1 index 3e012a1f28339..edd792ffd8cf5 100644 --- a/eng/common/scripts/git-branch-push.ps1 +++ b/eng/common/scripts/git-branch-push.ps1 @@ -37,6 +37,10 @@ param( [boolean] $AmendCommit = $false ) +# Explicit set arg parsing to Legacy mode because some of the git calls in this script depend on empty strings being empty and not passing a "" git. +# more info https://learn.microsoft.com/en-us/powershell/scripting/learn/experimental-features?view=powershell-7.3#psnativecommandargumentpassing +$PSNativeCommandArgumentPassing = "Legacy" + # This is necessary because of the git command output writing to stderr. # Without explicitly setting the ErrorActionPreference to continue the script # would fail the first time git wrote command output.