.gitignore's /hooks line silently excludes the hooks/ directory, not just the go-build artifact #4

Open
opened 2026-08-16 17:05:49 +03:00 by issuer-agent · 0 comments
Collaborator

Why: This repo's .gitignore contains:

# go build without -o drops a same-named binary in CWD
/hooks

/hooks matches both a file and a directory named hooks at the repo root, so the whole hooks/ directory is gitignored. hooks/hooks.json itself currently survives only because it is already tracked (gitignore doesn't affect tracked files) — but any NEW file added under hooks/ (e.g. a new hook script) is silently ignored. git add hooks/<newfile> refuses with "paths are ignored by one of your .gitignore files", and git add -A simply skips it. In a Claude Code plugin repo, hooks/ is exactly where the hook manifest and hook scripts must live.

Reproduce:

touch hooks/probe.txt && git check-ignore -v hooks/probe.txt
# -> .gitignore:<n>:/hooks  hooks/probe.txt

Reference fix: oleks/claude-plugin-plugin-publishing already fixed this in v1.28.0, commit 197a6b1 — add !/hooks/ after the /hooks line. Known caveat to repeat rather than rediscover: this negation also un-ignores a stray hooks file 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 bare go build cannot create that stray file while the hooks/ directory exists (it errors) — the documented build is -o bin/hooks — and a stray artifact showing up in git status is visible, whereas a silently-dropped hook script is not.

Acceptance:

  • .gitignore updated so hooks/ is not ignored (e.g. add !/hooks/ after the /hooks line), matching the plugin-publishing fix
  • git check-ignore -v hooks/probe.txt (or similar) no longer reports the directory as ignored
  • Confirm no currently-untracked file under hooks/ was silently dropped

Links: reference fix oleks/claude-plugin-plugin-publishing@197a6b1 (v1.28.0)

**Why**: This repo's `.gitignore` contains: ``` # go build without -o drops a same-named binary in CWD /hooks ``` `/hooks` matches both a *file* and a *directory* named `hooks` at the repo root, so the whole `hooks/` directory is gitignored. `hooks/hooks.json` itself currently survives only because it is already tracked (gitignore doesn't affect tracked files) — but any NEW file added under `hooks/` (e.g. a new hook script) is silently ignored. `git add hooks/<newfile>` refuses with "paths are ignored by one of your .gitignore files", and `git add -A` simply skips it. In a Claude Code plugin repo, `hooks/` is exactly where the hook manifest and hook scripts must live. Reproduce: ``` touch hooks/probe.txt && git check-ignore -v hooks/probe.txt # -> .gitignore:<n>:/hooks hooks/probe.txt ``` **Reference fix**: `oleks/claude-plugin-plugin-publishing` already fixed this in v1.28.0, commit 197a6b1 — add `!/hooks/` after the `/hooks` line. Known caveat to repeat rather than rediscover: this negation also un-ignores a stray `hooks` *file* 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 bare `go build` cannot create that stray file while the `hooks/` directory exists (it errors) — the documented build is `-o bin/hooks` — and a stray artifact showing up in `git status` is visible, whereas a silently-dropped hook script is not. **Acceptance**: - [ ] `.gitignore` updated so `hooks/` is not ignored (e.g. add `!/hooks/` after the `/hooks` line), matching the plugin-publishing fix - [ ] `git check-ignore -v hooks/probe.txt` (or similar) no longer reports the directory as ignored - [ ] Confirm no currently-untracked file under `hooks/` was silently dropped **Links**: reference fix oleks/claude-plugin-plugin-publishing@197a6b1 (v1.28.0)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: oleks/claude-plugin-fleet-integration#4