Skip to content

fix(hooks): warn when preserved pre-commit hook does not dispatch pre-commit.d (#52)#55

Open
olavostauros wants to merge 1 commit into
KnickKnackLabs:mainfrom
olavostauros:quick/warn-undispatching-hook
Open

fix(hooks): warn when preserved pre-commit hook does not dispatch pre-commit.d (#52)#55
olavostauros wants to merge 1 commit into
KnickKnackLabs:mainfrom
olavostauros:quick/warn-undispatching-hook

Conversation

@olavostauros

Copy link
Copy Markdown
Contributor

Summary

When install-hooks or setup preserves an existing custom pre-commit hook that does not dispatch pre-commit.d/, print a warning explaining that the modules guards were installed but may not run.

The heuristic uses grep -q 'pre-commit\.d' — simple, catches the vast majority of real dispatchers, and false positives are harmless warnings.

Closes #52

Changes

File Change
lib/hooks.sh Added elif branch in install_pre_commit_hooks — warns when preserved hook doesn't mention pre-commit.d
test/hooks.bats 2 new tests: warning fires for non-dispatching hook, stays quiet for dispatching hook

Validation

  • mise run test — 138/138 passing
  • codebase lint "$PWD"
  • git diff --check

@olavostauros
olavostauros force-pushed the quick/warn-undispatching-hook branch from 4a49d6f to c526e57 Compare June 26, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warn when preserved pre-commit hooks do not dispatch pre-commit.d

1 participant