mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-11-15 01:29:02 +08:00
The generated `.codegraph/.gitignore` ignores everything but itself, so the rule can be committed and shared. For someone using CodeGraph alone, that leaves `.codegraph/` showing as untracked in `git status`, with a file to commit that nobody else needs. `codegraph init --local-only` makes the file the wildcard alone, so it ignores itself too and nothing of CodeGraph's shows in git. It works on a new project and on one that's already initialized, where it converts the file without indexing again. Plain `codegraph init` is unchanged. Only a file CodeGraph generated is replaced. A file with the user's own rules is left alone, and so is a default the repository has committed, because rewriting a tracked file would show up as a change, the opposite of what the flag is for. Both cases say why they were left. The local-only file carries no generated header, so every later open leaves it alone. A flag rather than the proposed CODEGRAPH_LOCAL_GITIGNORE env var: the file is only written when it is missing, so an env var does nothing for a project that already has one, which is the reporter's case; an env var in a shell profile would also silently stop every new project sharing the rule, team repositories included. The flag is also what the issue proposed. Validation: 22 new tests, the CLI ones against real git repositories. They cover `git status --porcelain` staying empty, the default unchanged without the flag, conversion leaving the database untouched, and the file surviving sync, status, index and a plain init. Reimplements PR 1013 by @jiangyq9. Fixes #910 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>