CLI-715 better support for git worktrees during integration#547
CLI-715 better support for git worktrees during integration#547sophio-japharidze-sonarsource wants to merge 2 commits into
Conversation
✅ Deploy Preview for sonarqube-cli ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
0f06306 to
bc03827
Compare
bc03827 to
0aaf2b4
Compare
0aaf2b4 to
4cf9c21
Compare
| /** | ||
| * The current working tree's root, passed to CAG so it can locate (or lazily | ||
| * create) the per-workspace daemon folder from any git worktree. Set only when | ||
| * the repository's main working tree has a recorded integration. | ||
| */ | ||
| workspaceDir?: string; |
There was a problem hiding this comment.
💡 Quality: workspaceDir doc says "current working tree" but value is main tree
The workspaceDir field's doc comment in context-augmentation-env.ts describes it as "The current working tree's root". However, the value actually assigned (in resolveRecordedContextAugmentationConfig, context/index.ts:156) is getOptionalStringAttr(match.attrs, 'repoRoot') ?? match.targetRoot — i.e. the recorded main working tree / integrated folder, deliberately NOT the current working tree. The context/index.ts comment correctly explains this ('the stable main-working-tree key ... correct from any subfolder or linked worktree'). This is the whole point of the change: CAG resolves the same workspace regardless of which linked worktree it is invoked from. The interface comment contradicts that intent and could mislead a future reader into thinking the current worktree is passed. Suggest aligning the comment with the actual semantics (the repository's main working tree / recorded integrated folder).
Correct the comment to describe the main working tree, matching the value actually passed.:
/**
* The repository's main working tree (the recorded integrated folder), passed
* to CAG so it can locate (or lazily create) the per-workspace daemon folder
* consistently from any git worktree. Set only when the repository's main
* working tree has a recorded integration.
*/
workspaceDir?: string;
- Apply fix
Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 1 resolved / 2 findingsImproves Git worktree support by decoupling repo root from physical target paths and ensuring state consistency across branches. Please update the 💡 Quality: workspaceDir doc says "current working tree" but value is main tree📄 src/cli/commands/_common/context-augmentation-env.ts:29-34 📄 src/cli/commands/context/index.ts:151-156 The Correct the comment to describe the main working tree, matching the value actually passed.✅ 1 resolved✅ Quality: Test comment misstates production canonicalization behavior
🤖 Prompt for agentsOptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|



Summary by Gitar
lib/project-workspace/git-worktree.tsto canonicalize paths and resolve main working tree roots.analyze agenticto check both current and main working tree paths for project metadata.integratecommands to persistrepoRoot(the main working tree) in state attributes, decoupling it from the physicaltargetRoot.sonar contextto match current paths against eitherrepoRootortargetRoot, ensuring state persists across linked worktree creation.context-augmentation.test.tsandanalyze-sqaa.test.tsto verify cross-worktree state resolution.CLAUDE.mdto detail worktree-aware resolution logic for SQAA and Context Augmentation.This will update automatically on new commits.