Skip to content

Commit

Permalink
Fix bug in git branch push (#1167)
Browse files Browse the repository at this point in the history
Fix bug in git-branch-push.ps1
  • Loading branch information
chidozieononiwu authored Nov 5, 2020
1 parent 905086b commit cbbe9d3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 12 additions & 3 deletions eng/common/scripts/git-branch-push.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ param(
[string] $RemoteName = "azure-sdk-fork",

[Parameter(Mandatory = $false)]
[boolean] $SkipCommit = $false
[boolean] $SkipCommit = $false,

[Parameter(Mandatory = $false)]
[boolean] $AmendCommit = $false
)

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

if (!$SkipCommit) {
Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit --amend -am `"$($CommitMsg)`""
git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" commit --amend -am "$($CommitMsg)"
if ($AmendCommit) {
$amendOption = "--amend"
}
else {
$amendOption = ""
}
Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit $amendOption -am `"$($CommitMsg)`""
git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" commit $amendOption -am "$($CommitMsg)"
if ($LASTEXITCODE -ne 0)
{
Write-Error "Unable to add files and create commit LASTEXITCODE=$($LASTEXITCODE), see command output above."
Expand Down
1 change: 1 addition & 0 deletions eng/pipelines/templates/steps/sync-directory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ steps:
-CommitMsg "${{ parameters.CommitMessage }}"
-GitUrl "https://$(azuresdk-github-pat)@github.com/${{ parameters.PROwner }}/${{ repo }}.git"
-PushArgs "${{ parameters.PushArgs }}"
-AmendCommit $True
- task: PowerShell@2
displayName: Queue test pipeline
Expand Down

0 comments on commit cbbe9d3

Please sign in to comment.