fix(gbrain-sync): append .gbrain-source to consumer repo's .gitignore after successful attach#1433
Open
rmotgi1227 wants to merge 1 commit into
Open
Conversation
… after attach Add .gbrain-source to consumer repo's .gitignore to prevent accidental commits.
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.
… after attach
Summary
Fixes #1384
The v1.29.0.0 changelog promised:
However, the shipped code only added
.gbrain-sourceto gstack's own.gitignore— not to the consumer repo's.gitignore. This PR fixes that gap.Root Cause
In
bin/gstack-gbrain-sync.ts, aftergbrain sources attach <id>succeeds, the.gbrain-sourcepin file is written to the consumer repo's root. The v1.29.0.0 implementation correctly hashes by path to give each worktree a unique source ID, but it never appended.gbrain-sourceto the consumer repo's.gitignore.Without this gitignore entry, the pin file shows up as an untracked file and can be accidentally committed (via
git add -A, pre-commit hooks, etc.), causing it to propagate to other branches and worktrees — silently overriding their per-worktree pin on nextgit pull.Fix
After a successful
gbrain sources attach, append.gbrain-sourceto<root>/.gitignoreif not already present. The operation is:.gitignorelogs a warning and continues (never aborts the sync)Before / After
Why this matters for Conductor users
Conductor users run
/sync-gbrainin multiple sibling worktrees of the same repo+branch. Each worktree correctly gets a different path-hash source ID (per v1.29.0.0), but if either pin gets committed,git pullin the sibling overwrites the local pin and routes gbrain queries to the wrong worktree's code source. This is exactly the failure mode the changelog claimed to prevent.Single-worktree users aren't badly affected but still benefit from a clean
git status.Need help on this PR? Tag
@codesmithwith what you need.