Repository navigation
fix(gitignore): ignore vim and emacs editor litter - #1272
lb1192176991-lab wants to merge 1 commit into
Conversation
|
Heads-up: this branch is currently behind
Once updated, CI will re-run. Thanks! |
sonukapoor
left a comment
There was a problem hiding this comment.
This is a good first contribution and the write-up is better than most. Everything in your testing section reproduces: all six litter forms are ignored by exactly the rules you name, at the root and in a subdirectory, and git ls-files -i -c --exclude-standard still returns the same nine examples/*/node_modules fixture entries it returns on main, so nothing tracked gets swallowed.
Your reason for avoiding a *CLAUDE*.md* / *AGENTS*.md* catch-all also holds, and it is the part I would have got wrong. core.ignoreCase is true here and that pattern does match website/docs/case-studies/openai-agents-js.md. Worth adding one wrinkle for anyone reading this later: git check-ignore consults the index by default, so on that tracked path it reports nothing and the match only shows under --no-index. The practical exposure is therefore a future case study with a similar name rather than that file disappearing, which does not change your conclusion.
One ask, and it is new information rather than something you missed. tests/gitignore.test.ts now exists on main. #1249 added it after you opened this, and it pins the local-notes patterns with git check-ignore per form plus a guard that no tracked file is newly ignored.
Nothing pins your six patterns: removing \#*\# from .gitignore leaves all thirteen of those tests green, so any of them can be deleted silently and nothing notices. Could you add your table to that test? It is close to a transcription of what is already in your PR body, and the parameterised ignores %s case there takes a list, so it should be a short addition.
Nothing else. It still merges cleanly against current main, the tracked-but-ignored set is unchanged at the nine examples/*/node_modules fixtures, and it does not conflict with #1273.
What changed and why
Adds generic editor-litter ignore patterns to
.gitignore:*.swp,*.swo,*.un~,*~,\#*\#, and.#*.This closes the prefix-shaped class of the
CLAUDE.mdleak gap that #1249 left open. Vim swap files (.CLAUDE.md.swp,.CLAUDE.md.swo), vim persistent undo (.CLAUDE.md.un~), and emacs autosave/lock files (#CLAUDE.md#,.#CLAUDE.md) are written automatically on edit and contain the file's contents, so they leak the same contact / letter-pipeline data as the suffix-shaped names #1249 already covers. Nothing on the machine catches these today — there is no globalcore.excludesfile, and.git/info/exclude's*~line is commented out.I deliberately avoided a
*CLAUDE*.md*/*AGENTS*.md*catch-all: on macOScore.ignoreCase=truewould match the trackedwebsite/docs/case-studies/openai-agents-js.md.Testing
git check-ignore -vnames a rule for each litter form, at root and in a subdirectory:.CLAUDE.md.swp->*.swp.CLAUDE.md.swo->*.swo.CLAUDE.md.un~->*~#CLAUDE.md#->\#*\#.#CLAUDE.md->.#*foo~->*~git ls-files -i -c --exclude-standardstill returns exactly the 9 pre-existingexamples/*/node_modules/*/package.jsonfixture entries — no tracked file is swallowed.Closes #1267