Skip to content

Commit

Permalink
print the warning again
Browse files Browse the repository at this point in the history
  • Loading branch information
kairu-ms committed Nov 11, 2024
1 parent b8818df commit 2e5a66b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .githooks/pre-push.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,17 @@ if ($LASTEXITCODE -ne 0) {
}

Write-Host "Pre-push hook passed." -ForegroundColor Green

if ($mergeBase -ne $upstreamHead) {
Write-Host ""
Write-Host "Your branch is not up to date with upstream/dev. Please run the following commands to rebase code and setup:" -ForegroundColor Yellow
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++" -ForegroundColor Yellow
Write-Host "git rebase upstream/dev" -ForegroundColor Yellow
if ($Extensions) {
Write-Host "azdev setup -c $AZURE_CLI_FOLDER -r $Extensions" -ForegroundColor Yellow
} else {
Write-Host "azdev setup -c $AZURE_CLI_FOLDER" -ForegroundColor Yellow
}
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++" -ForegroundColor Yellow
}
exit 0
16 changes: 16 additions & 0 deletions .githooks/pre-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,21 @@ if [ $? -ne 0 ]; then
fi

echo "\033[0;32mPre-push hook passed.\033[0m"

if [ "$MERGE_BASE" != "$UPSTREAM_HEAD" ]; then
echo ""
echo "\033[1;33mYour branch is not up to date with upstream/dev. Please run the following commands to rebase and setup:\033[0m"
echo "\033[1;33m+++++++++++++++++++++++++++++++++++++++++++++++++++++++\033[0m"
echo "\033[1;33mgit rebase upstream/dev\033[0m"

# Get extension repo paths
EXTENSIONS=$(azdev extension repo list -o tsv | tr '\n' ' ')
if [ -n "$EXTENSIONS" ]; then
echo "\033[1;33mazdev setup -c $AZURE_CLI_FOLDER -r $EXTENSIONS\033[0m"
else
echo "\033[1;33mazdev setup -c $AZURE_CLI_FOLDER\033[0m"
fi
echo "\033[1;33m+++++++++++++++++++++++++++++++++++++++++++++++++++++++\033[0m"
fi
exit 0

0 comments on commit 2e5a66b

Please sign in to comment.