Skip to content

Commit 32df120

Browse files
Fix bug in git branch push (Azure#15021)
Co-authored-by: Chidozie Ononiwu <chononiw@microsoft.com>
1 parent c113d83 commit 32df120

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

eng/common/scripts/git-branch-push.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ param(
3030
[string] $RemoteName = "azure-sdk-fork",
3131

3232
[Parameter(Mandatory = $false)]
33-
[boolean] $SkipCommit = $false
33+
[boolean] $SkipCommit = $false,
34+
35+
[Parameter(Mandatory = $false)]
36+
[boolean] $AmendCommit = $false
3437
)
3538

3639
# This is necessay because of the janky git command output writing to stderr.
@@ -66,8 +69,14 @@ if ($LASTEXITCODE -ne 0)
6669
}
6770

6871
if (!$SkipCommit) {
69-
Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit --amend -am `"$($CommitMsg)`""
70-
git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" commit --amend -am "$($CommitMsg)"
72+
if ($AmendCommit) {
73+
$amendOption = "--amend"
74+
}
75+
else {
76+
$amendOption = ""
77+
}
78+
Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit $amendOption -am `"$($CommitMsg)`""
79+
git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" commit $amendOption -am "$($CommitMsg)"
7180
if ($LASTEXITCODE -ne 0)
7281
{
7382
Write-Error "Unable to add files and create commit LASTEXITCODE=$($LASTEXITCODE), see command output above."

0 commit comments

Comments
 (0)