Git workflow, environments & CI/CD pipeline (#1)
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Point git at the version-controlled hooks in scripts/git-hooks.
|
||||
.DESCRIPTION
|
||||
Uses `git config core.hooksPath` so the hooks live in the repo (reviewable,
|
||||
shared, updatable) instead of the un-tracked .git/hooks directory. Run once
|
||||
per clone. Git for Windows ships the bash needed to execute the POSIX hooks.
|
||||
.EXAMPLE
|
||||
./scripts/install-hooks.ps1
|
||||
#>
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$root = Split-Path -Parent $PSScriptRoot
|
||||
Push-Location $root
|
||||
try {
|
||||
git config core.hooksPath scripts/git-hooks
|
||||
# Best-effort exec bit (matters on Linux/WSL; harmless on Windows). Only applies
|
||||
# once the hooks are tracked; ignored on a first run before they're committed.
|
||||
foreach ($h in 'pre-commit','pre-push') {
|
||||
try { git update-index --chmod=+x "scripts/git-hooks/$h" 2>$null } catch {}
|
||||
}
|
||||
Write-Host "Installed git hooks -> scripts/git-hooks (core.hooksPath set)." -ForegroundColor Green
|
||||
Write-Host "Bypass in an emergency with --no-verify." -ForegroundColor DarkGray
|
||||
}
|
||||
finally { Pop-Location }
|
||||
Reference in New Issue
Block a user