File tree Expand file tree Collapse file tree 3 files changed +48
-24
lines changed
Expand file tree Collapse file tree 3 files changed +48
-24
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env sh
2- " :" //; if command -v pwsh > /dev/null 2>&1 ; then pwsh -ExecutionPolicy Bypass -File .githooks/pre-commit.ps1; else sh .githooks/pre-commit.sh; fi ; exit $? # Try PowerShell Core first, then sh on Unix
3- " :" //; exit # Skip rest on Unix
42
5- @echo off
6- powershell -NoProfile -Command " if (Get-Command powershell -ErrorAction SilentlyContinue) { exit 0 } else { exit 1 }"
7- if %errorlevel% equ 0 (
8- powershell -ExecutionPolicy Bypass -File .githooks\p re-commit.ps1
9- ) else (
10- echo Error: PowerShell is not available. Please install PowerShell.
11- exit /b 1
12- )
13- exit /b %errorlevel%
3+ # Check if running in Windows
4+ if [ -n " $COMSPEC " ]; then
5+ # Windows section - Execute directly with PowerShell
6+ powershell -NoProfile -Command "
7+ if (Get-Command powershell -ErrorAction SilentlyContinue) {
8+ Write-Host 'PowerShell found, executing pre-commit.ps1...'
9+ powershell -ExecutionPolicy Bypass -File '.githooks\pre-commit.ps1'
10+ exit $LASTEXITCODE
11+ } else {
12+ Write-Host 'Error: PowerShell is not available. Please install PowerShell.'
13+ exit 1
14+ }
15+ "
16+ echo " Exiting with status $? "
17+ exit $?
18+ else
19+ # Unix-like system section
20+ echo " Unix-like system found, executing pre-commit.sh..."
21+ sh .githooks/pre-commit.sh
22+ echo " Exiting with status $? "
23+ exit $?
24+ fi
Original file line number Diff line number Diff line change 11#! /usr/bin/env sh
2- " :" //; if command -v pwsh > /dev/null 2>&1 ; then pwsh -ExecutionPolicy Bypass -File .githooks/pre-push.ps1; else sh .githooks/pre-push.sh; fi ; exit $? # Try PowerShell Core first, then sh on Unix
3- " :" //; exit # Skip rest on Unix
42
5- @echo off
6- powershell -NoProfile -Command " if (Get-Command powershell -ErrorAction SilentlyContinue) { exit 0 } else { exit 1 }"
7- if %errorlevel% equ 0 (
8- powershell -ExecutionPolicy Bypass -File .githooks\p re-push.ps1
9- ) else (
10- echo Error: PowerShell is not available. Please install PowerShell.
11- exit /b 1
12- )
13- exit /b %errorlevel%
3+ # Check if running in Windows
4+ if [ -n " $COMSPEC " ]; then
5+ # Windows section - Execute directly with PowerShell
6+ powershell -NoProfile -Command "
7+ if (Get-Command powershell -ErrorAction SilentlyContinue) {
8+ Write-Host 'PowerShell found, executing pre-push.ps1...'
9+ powershell -ExecutionPolicy Bypass -File '.githooks\pre-push.ps1'
10+ exit $LASTEXITCODE
11+ } else {
12+ Write-Host 'Error: PowerShell is not available. Please install PowerShell.'
13+ exit 1
14+ }
15+ "
16+ echo " Exiting with status $? "
17+ exit $?
18+ else
19+ # Unix-like system section
20+ echo " Unix-like system found, executing pre-push.sh..."
21+ sh .githooks/pre-push.sh
22+ echo " Exiting with status $? "
23+ exit $?
24+ fi
Original file line number Diff line number Diff line change @@ -66,8 +66,10 @@ if ($AZURE_CLI_FOLDER) {
6666 Write-Host " Would you like to automatically rebase and setup? [Y/n]" - ForegroundColor Yellow
6767
6868 try {
69- $reader = [System.IO.StreamReader ]::new(" CON" )
70- $input = $reader.ReadLine ()
69+ $input = Read-Host
70+ if ([string ]::IsNullOrEmpty($input )) {
71+ $input = " Y"
72+ }
7173 } catch {
7274 Write-Host " Error reading input. Aborting push..." - ForegroundColor Red
7375 exit 1
You can’t perform that action at this time.
0 commit comments