mirror of https://github.com/icsharpcode/ILSpy.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
807 B
22 lines
807 B
#!/usr/bin/env pwsh |
|
# Trigger the commit hook's formatter against the working tree without committing, |
|
# applying the same formatting the pre-commit hook enforces. |
|
$ErrorActionPreference = 'Stop' |
|
$env:OPENSSL_ENABLE_SHA1_SIGNATURES = '1' |
|
Push-Location (Join-Path $PSScriptRoot '..') |
|
try { |
|
# On Windows, a bare `bash` can resolve to the WSL launcher (System32\bash.exe), |
|
# which runs the hook inside a Linux distro where the CRLF-checked-out script |
|
# cannot even be parsed. Pin to Git Bash, the same CRLF-tolerant shell git |
|
# itself uses to run the pre-commit hook. |
|
$bash = if ($IsWindows) { |
|
Join-Path (Split-Path (Split-Path (Get-Command git).Source)) 'bin\bash.exe' |
|
} |
|
else { |
|
'bash' |
|
} |
|
& $bash BuildTools/pre-commit --format |
|
} |
|
finally { |
|
Pop-Location |
|
}
|
|
|