19 lines
878 B
PowerShell
19 lines
878 B
PowerShell
# install-git-hooks.ps1 - install changelog pre-commit / post-merge git hooks into this repo.
|
|
# Git hooks are not distributed with the repo; run this once per clone (idempotent).
|
|
# Usage: powershell -ExecutionPolicy Bypass -File .cursor/changelog/tools/install-git-hooks.ps1
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$hooksDir = (git rev-parse --git-path hooks 2>$null)
|
|
if (-not $hooksDir) { Write-Error "not inside a git repository"; exit 1 }
|
|
if (-not (Test-Path $hooksDir)) { New-Item -ItemType Directory -Force -Path $hooksDir | Out-Null }
|
|
|
|
$src = Join-Path $PSScriptRoot "git-hooks"
|
|
foreach ($name in @("pre-commit", "post-merge")) {
|
|
$from = Join-Path $src $name
|
|
$to = Join-Path $hooksDir $name
|
|
Copy-Item -Force $from $to
|
|
Write-Output "installed: $to"
|
|
}
|
|
Write-Output "done. git hooks installed (pre-commit rebuilds + stages views, post-merge rebuilds after merge)."
|