1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#!/usr/bin/env sh
# Check if running in Windows
if [ -n "$COMSPEC" ]; then
# Windows section - Execute directly with PowerShell
powershell -NoProfile -Command "
if (Get-Command powershell -ErrorAction SilentlyContinue) {
Write-Host 'PowerShell found, executing pre-commit.ps1...'
powershell -ExecutionPolicy Bypass -File '.githooks\pre-commit.ps1'
exit $LASTEXITCODE
} else {
Write-Host 'Error: PowerShell is not available. Please install PowerShell.'
exit 1
}
"
echo "Exiting with status $?"
exit $?
else
# Unix-like system section
echo "Unix-like system found, executing pre-commit.sh..."
sh .githooks/pre-commit.sh
echo "Exiting with status $?"
exit $?
fi
|