Skip to content

fix(gitignore): anchor "coverage/" to repo root (unblocks src/coverage/, packages/*/coverage/)#10

Open
mschreib28 wants to merge 1 commit into
mainfrom
upstream/fix/gitignore-anchor-coverage
Open

fix(gitignore): anchor "coverage/" to repo root (unblocks src/coverage/, packages/*/coverage/)#10
mschreib28 wants to merge 1 commit into
mainfrom
upstream/fix/gitignore-anchor-coverage

Conversation

@mschreib28
Copy link
Copy Markdown
Owner

Summary\n\nThe coverage/ rule on line 21 of .gitignore is unanchored — it matches any coverage/ directory in the tree, not just the test-output one at the repo root. This is a real footgun: when adding a src/coverage/ module (or packages/*/coverage/ in a monorepo), git add silently drops the files with no warning.\n\nThis bit me on PR colbymchenry#124 — the src/coverage/ module was written and tested locally, but never made it into the commit because git add src/coverage/ was silently swallowed. The PR shipped with __tests__/coverage.test.ts importing a module that didn't exist; whoever rebases or merges it hits a build failure that's confusing to debug.\n\nThe fix anchors the rule to the repo root: /coverage/. This still ignores the test-output coverage/ at root (the original intent) while allowing source paths like src/coverage/ to be committed normally.\n\n## Test plan\n\n- [x] git check-ignore -v src/coverage/foo.ts → no longer matches\n- [x] git check-ignore -v coverage/lcov.info → still matches the root-level rule\n- [x] No code changes; behavior is purely the gitignore semantics\n\nIndependent of the issue colbymchenry#120 merge guide — this can land any time and helps every future PR that touches anything named coverage/ outside the repo root.\n\n🤖 Generated with Claude Code\n


Copied from colbymchenry/codegraph#127

The unanchored "coverage/" rule (intended to ignore the test-output
directory at repo root) silently matches any "coverage/" directory in
the tree. This bit a real PR: src/coverage/ was added but never made
it into the commit because git add silently dropped the files. The
PR shipped with the test importing a module that didn't exist.

Anchor the rule to "/coverage/" so it only ignores root-level test
output, allowing src/coverage/, packages/*/coverage/, etc. to be
committed normally.
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.

2 participants