fix: add all sidecar state files to .gitignore on init and startup#211
Merged
fix: add all sidecar state files to .gitignore on init and startup#211
Conversation
Previously, only '.todos/' was added to .gitignore when initializing a new git repository, and nothing was added for existing repos. This meant sidecar state files (.sidecar/, .sidecar-agent, .sidecar-task, etc.) could appear as untracked files before the first worktree was created. Changes: - Rename initRepoGitignoreEntries to sidecarGitignoreEntries and expand it to include all sidecar state paths (.sidecar/, .sidecar-agent, .sidecar-task, .sidecar-pr, .sidecar-start.sh, .sidecar-base, .td-root) - Call ensureGitignoreEntries in Start() for existing repos so entries are added on every sidecar startup (idempotent, best-effort) - Add tests: AllSidecarEntries validates the full list; Start_EnsuresGitignore validates the existing-repo path Fixes #201
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When sidecar ran for the first time against an existing repo, the
.gitignorewas never updated. For new repos (viagit initin sidecar), only.todos/was added. This meant sidecar state files appeared as untracked files before the first worktree was created.Fixes #201
Solution
Option 1 from the issue: add all sidecar entries unconditionally.
Changes
sidecarGitignoreEntries— renamed frominitRepoGitignoreEntriesand expanded to cover all sidecar state paths:Start()in gitstatus plugin — callsensureGitignoreEntriesfor existing repos on every startup. The call is idempotent (only appends missing entries) and best-effort (errors are non-fatal).TestEnsureGitignoreEntries_AllSidecarEntriesvalidates the full entry list;TestStart_EnsuresGitignoreForExistingRepovalidates the existing-repo path.Testing
All pass.