.gitignore's /hooks line silently excludes the hooks/ directory, not just the go-build artifact
#4
Reference in New Issue
Block a user
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?
Why: This repo's
.gitignorecontains:/hooksmatches both a file and a directory namedhooksat the repo root, so the wholehooks/directory is gitignored.hooks/hooks.jsonitself currently survives only because it is already tracked (gitignore doesn't affect tracked files) — but any NEW file added underhooks/(e.g. a new hook script) is silently ignored.git add hooks/<newfile>refuses with "paths are ignored by one of your .gitignore files", andgit add -Asimply skips it. In a Claude Code plugin repo,hooks/is exactly where the hook manifest and hook scripts must live.Reproduce:
Reference fix:
oleks/claude-plugin-plugin-publishingalready fixed this in v1.28.0, commit 197a6b1 — add!/hooks/after the/hooksline. Known caveat to repeat rather than rediscover: this negation also un-ignores a strayhooksfile at the root (git does not honor the trailing slash as directory-only in this negation position). That trade was accepted deliberately there, because a barego buildcannot create that stray file while thehooks/directory exists (it errors) — the documented build is-o bin/hooks— and a stray artifact showing up ingit statusis visible, whereas a silently-dropped hook script is not.Acceptance:
.gitignoreupdated sohooks/is not ignored (e.g. add!/hooks/after the/hooksline), matching the plugin-publishing fixgit check-ignore -v hooks/probe.txt(or similar) no longer reports the directory as ignoredhooks/was silently droppedLinks: reference fix oleks/claude-plugin-plugin-publishing@197a6b1 (v1.28.0)