Skip to content

fix(gitignore): ignore vim and emacs editor litter - #1272

Open
lb1192176991-lab wants to merge 1 commit into
OWASP:mainfrom
lb1192176991-lab:feature/issue-1267-editor-litter-gitignore
Open

lb1192176991-lab wants to merge 1 commit into
OWASP:mainfrom
lb1192176991-lab:feature/issue-1267-editor-litter-gitignore

Conversation

@lb1192176991-lab

Copy link
Copy Markdown

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.md leak 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 global core.excludesfile, and .git/info/exclude's *~ line is commented out.

I deliberately avoided a *CLAUDE*.md* / *AGENTS*.md* catch-all: on macOS core.ignoreCase=true would match the tracked website/docs/case-studies/openai-agents-js.md.

Testing

  • git check-ignore -v names 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-standard still returns exactly the 9 pre-existing examples/*/node_modules/*/package.json fixture entries — no tracked file is swallowed.

Closes #1267

@prx-my

prx-my commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Heads-up: this branch is currently behind main, which blocks the merge. Could you update it?

  • Click Update branch on this PR, or
  • Rebase locally:
    git fetch upstream
    git rebase upstream/main
    git push --force-with-lease
    

Once updated, CI will re-run. Thanks!

@sonukapoor sonukapoor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This branch has not been deployed

No deployments
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.

fix(gitignore): vim and emacs litter beside CLAUDE.md is still committable

3 participants