th pearls: skip git auto-commit from linked worktrees#94
Merged
Conversation
auto_commit_pearl_state committed the .smooth/dolt store to git on whatever branch the caller was on. Dolt rewrites mutable pointer files (journal.idx, manifest, journal chunk) on every open, and each linked worktree has its own checked-out copy — committing those onto feature branches produced binary pointer divergence that can't be merged back to main (recurring conflicts during the smooai SMOODEV-1818 migration). Detect a linked worktree via git-dir != git-common-dir and skip the git commit there (the dolt mutation + th pearls push to refs/dolt/data still capture the change). Primary-worktree behaviour unchanged. Adds is_linked_worktree + tests covering primary vs linked vs non-git dirs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: d545073 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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
auto_commit_pearl_stategit-commits the.smooth/dolt/pearls store on whatever branch the caller is on. Dolt rewrites its mutable pointer files (journal.idx,manifest, the journal chunk) on every store open, and each linked worktree (git worktree add) checks out its own copy. Committing those binary pointers onto a feature branch produces divergence that can't be merged back to main — the recurring.smooth/doltconflicts hit repeatedly during the smooai SMOODEV-1818 Lambda→Rust migration (one caused a transient pearl-close data-loss).Solution
Detect a linked worktree (
git rev-parse --git-dir≠--git-common-dir) and skip the git auto-commit there, logging a hint to run pearl mutations from the primary worktree. The dolt mutation andth pearls push(refs/dolt/data) still capture the change — pearl state simply stays on one lineage instead of forking per branch. Primary-worktree behaviour is unchanged.This is the every-repo half of the fix; the smooai side excludes
.smooth/doltfrom its pre-commitgit add -A(SmooAI/smooai#1513).Verification
is_linked_worktree+worktree_guard_tests: primary worktree → not linked,git worktree addtree → linked, non-git dir → false.cargo test -p smooai-smooth-cli worktree_guard→ 2 passed.cargo fmt --checkclean;cargo clippyclean (no new warnings).Tracking: SMOODEV-1836
🤖 Generated with Claude Code