fix(tool): detect repo root from a linked worktree in build_skill_assets - #113
Open
dipsy wants to merge 1 commit into
Open
fix(tool): detect repo root from a linked worktree in build_skill_assets#113dipsy wants to merge 1 commit into
dipsy wants to merge 1 commit into
Conversation
_findRepoRoot walked up looking for a `.git` directory, which only exists in a plain clone. In a linked worktree (and in a submodule checkout) `.git` is a file holding a `gitdir:` pointer, so the walk ran past the repo root and the tool aborted with "Bad state: Not in a git repo" — taking down `make sync-skills`, and with it `make compile`, for anyone building from a worktree. Accept both shapes of the marker. Plain clones keep hitting the directory check first, so their behaviour is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughChangesRepository root detection
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
_findRepoRoot()inmcp_server_dart/tool/build_skill_assets.dartwalks up from the current directory looking for a.gitdirectory. In a linked worktree (git worktree add) — and in a submodule checkout —.gitis a file holding agitdir:pointer, so the walk runs past the repo root and the tool aborts:sync-skillsis a prerequisite ofcompile, somake compilecannot run from a worktree at all. That is a normal setup when validating a PR branch side by side with a working checkout.Change
Accept both shapes of the marker — a
.gitdirectory or a.gitfile. Plain clones still match the directory check first, so their behaviour is unchanged.Verification
From a linked worktree, all previously failing paths now succeed and regenerate
skill_assets.g.dartbyte-identically to the committed file:make sync-skillsinmcp_server_dart/— the exact command that failed above;dart run mcp_server_dart/tool/build_skill_assets.dartfrom the worktree root and from a nested package directory;bash tool/contracts/check_skill_assets_drift.sh→skill_assets.g.dart in sync with plugin/;git statusafter the runs shows no drift beyond the tool file itself.Summary by CodeRabbit