@@ -52,7 +52,7 @@ if ((git remote) -contains $RemoteName)
52
52
exit 1
53
53
}
54
54
}
55
- else
55
+ else
56
56
{
57
57
Write-Host " git remote add $RemoteName $GitUrl "
58
58
git remote add $RemoteName $GitUrl
66
66
git show-ref -- verify -- quiet refs/ heads/ $PRBranchName
67
67
if ($LASTEXITCODE -eq 0 ) {
68
68
Write-Host " git checkout $PRBranchName ."
69
- git checkout $PRBranchName
70
- }
69
+ git checkout $PRBranchName
70
+ }
71
71
else {
72
72
Write-Host " git checkout -b $PRBranchName ."
73
73
git checkout - b $PRBranchName
@@ -83,10 +83,11 @@ if (!$SkipCommit) {
83
83
$amendOption = " --amend"
84
84
}
85
85
else {
86
- $amendOption = " "
86
+ # Explicitly set this to null so that PS command line parser doesn't try to parse pass it as ""
87
+ $amendOption = $null
87
88
}
88
- Write-Host " git -c user.name=`" azure-sdk`" -c user.email=`" [email protected] `" commit $amendOption -am `" $ ( $ CommitMsg) `" "
89
- git
- c user.name
= " azure-sdk" - c user.email
= " [email protected] " commit
$amendOption - am
" $ ( $ CommitMsg) "
89
+ Write-Host " git -c user.name=`" azure-sdk`" -c user.email=`" [email protected] `" commit $amendOption -am `" $CommitMsg `" "
90
+ git
- c user.name
= " azure-sdk" - c user.email
= " [email protected] " commit
$amendOption - am
" $CommitMsg "
90
91
if ($LASTEXITCODE -ne 0 )
91
92
{
92
93
Write-Error " Unable to add files and create commit LASTEXITCODE=$ ( $LASTEXITCODE ) , see command output above."
115
116
{
116
117
$needsRetry = $true
117
118
Write-Host " Git push failed with LASTEXITCODE=$ ( $LASTEXITCODE ) Need to fetch and rebase: attempt number=$ ( $tryNumber ) "
118
-
119
+
119
120
Write-Host " git fetch $RemoteName $PRBranchName "
120
121
# Full fetch will fail when the repo is in a sparse-checkout state, and single branch fetch is faster anyway.
121
122
git fetch $RemoteName $PRBranchName
162
163
continue
163
164
}
164
165
165
- Write-Host " git -c user.name=`" azure-sdk`" -c user.email=`" [email protected] `" commit -m `" $ ( $ CommitMsg) `" "
166
- git
- c user.name
= " azure-sdk" - c user.email
= " [email protected] " commit
- m
" $ ( $ CommitMsg) "
166
+ Write-Host " git -c user.name=`" azure-sdk`" -c user.email=`" [email protected] `" commit -m `" $CommitMsg `" "
167
+ git
- c user.name
= " azure-sdk" - c user.email
= " [email protected] " commit
- m
" $CommitMsg "
167
168
if ($LASTEXITCODE -ne 0 )
168
169
{
169
170
Write-Error " Unable to commit LASTEXITCODE=$ ( $LASTEXITCODE ) , see command output above."
183
184
if ($LASTEXITCODE -ne 0 -or $tryNumber -gt $numberOfRetries )
184
185
{
185
186
Write-Error " Unable to push commit after $ ( $tryNumber ) retries LASTEXITCODE=$ ( $LASTEXITCODE ) , see command output above."
186
- if (0 -eq $LASTEXITCODE )
187
+ if (0 -eq $LASTEXITCODE )
187
188
{
188
189
exit 1
189
190
}
0 commit comments