Generalize tracked repo hook dispatch in protected-refs-policy #60
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
run_cdk_tracked_hookinprotected-refs-policyis hardcoded to$HOME/work/cdkandmisc/git-hooks/pre-commit. It solves a real problem — running version-controlled hooks whencore.hooksPathoverrides.git/hooks/— but the solution is repo-specific.Proposed generic replacement: a
.hookspathfile in the repo root containing the relative path to the tracked hooks directory. The policy script reads it and dispatches$repo/$hookspath/$hookif it exists and is executable.Example: cdk would get a
.hookspathcontainingmisc/git-hooks. No changes to the external project — we just add the file to our working copy (or gitignore it upstream and track it locally).Steps:
.hookspathlookup torun_tracked_hookreplacingrun_cdk_tracked_hook$repo/.hooks/$hookif no.hookspathexists (zero-config convention).hookspathto cdk checkout with contentmisc/git-hooksrun_repo_hook(.git/hooks/$hook) stays as-is for untracked repo-local hooks