Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check remote refs instead of local refs when applying/pushing changes #1645

Merged
1 commit merged into from
Jun 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions eng/common/scripts/git-branch-push.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ param(
[boolean] $AmendCommit = $false
)

# This is necessay because of the janky git command output writing to stderr.
# 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.
$ErrorActionPreference = "Continue"
Expand Down Expand Up @@ -116,8 +116,9 @@ do
$needsRetry = $true
Write-Host "Git push failed with LASTEXITCODE=$($LASTEXITCODE) Need to fetch and rebase: attempt number=$($tryNumber)"

Write-Host "git fetch $RemoteName"
git fetch $RemoteName
Write-Host "git fetch $RemoteName $PRBranchName"
# Full fetch will fail when the repo is in a sparse-checkout state, and single branch fetch is faster anyway.
git fetch $RemoteName $PRBranchName
if ($LASTEXITCODE -ne 0)
{
Write-Error "Unable to fetch remote LASTEXITCODE=$($LASTEXITCODE), see command output above."
Expand Down