feat: add worktree management commands, per-worktree trunks, and worktree-aware filtering#1223
Draft
ed-irl wants to merge 2 commits into
Draft
feat: add worktree management commands, per-worktree trunks, and worktree-aware filtering#1223ed-irl wants to merge 2 commits into
ed-irl wants to merge 2 commits into
Conversation
Collaborator
Author
|
This change is part of the following stack:
Change managed by git-spice. |
13fcb5b to
ce6c1aa
Compare
2f2d7a9 to
673dc16
Compare
This was referenced Jun 2, 2026
5582ec7 to
ee1f597
Compare
673dc16 to
3c58177
Compare
ee1f597 to
9f8657d
Compare
3c58177 to
75e05c0
Compare
1113e5d to
312db25
Compare
e46ecf6 to
658c245
Compare
312db25 to
6ab1da8
Compare
658c245 to
9b32be2
Compare
6ab1da8 to
167cca4
Compare
9b32be2 to
b8a0e76
Compare
167cca4 to
d049480
Compare
b8a0e76 to
9bb9a70
Compare
41864dd to
93682d9
Compare
00e9ec6 to
ed5caa4
Compare
Until now every inline comment was line-scoped: anchored to a specific path:line on the diff. The extension contract (issue irl-llc/git-spice-code-extension#40) wants three rendering surfaces: - line: anchored to one line (existing) - file: anchored to a file but not a line — rendered at the top of the file diff - pr: not anchored to anything — rendered at the top of the summary diff Plumb that distinction end-to-end: - forge.CommentScope enum + String() ("pr"/"file"/"line"). - forge.CommentRange struct for multi-line ranges. - forge.InlineComment and InlineCommentRequest grow Scope, Range, Side fields. (CommitSHA still lands in the JSON-exposure commit above.) - shamhub plumbs Scope/Range through the inline-comment API, storage, and the SubmitReview batch path. The list filter switches from "Path \!= ''" to "Scope \!= ''" so PR-scope comments (which have no path) appear, while change-level comments created via the legacy non-inline endpoint stay excluded. - shamhub 'comment edit' is unchanged here — Scope is set at post time, not via the edit knob. CLI shape — the positional anchor argument now distinguishes scope by its form: gs branch comment add file.go:42 line scope gs branch comment add file.go:42-50 line scope multi-line gs branch comment add file.go file scope (path only) gs branch comment add --pr pr scope (no anchor) parseAnchor centralizes the decoding and rejects --pr-with-arg and missing-anchor cases up front so the user gets a clear error before any forge call. parseFileAndRange is split out of parseFileAndLine to back the multi-line form. Test branch_comment_scopes.txt exercises all three scopes, confirms they round-trip through 'gs branch comment list', and verifies the two error cases. The JSON-shape assertion lives in the extension-json commit above this one.
93682d9 to
e8e87b4
Compare
62a5aa0 to
204ded0
Compare
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.
Add
gs worktree createandgs worktree list.worktree createsets up a per-worktree trunk: a local branch (named after the worktree dir, or--trunk) that tracks the same remote ref as the canonical trunk, so sync and restack in different worktrees never contend on a single shared trunk checkout.--no-trunkkeeps the legacy detached-HEAD behavior;-balso creates a tracked branch stacked on the worktree trunk.Persist the per-worktree trunk registry in the state store under an additive, optional
worktree-trunkskey (older binaries and pre-feature repos see no entry and fall back to the canonical trunk). AddStore.IsTrunk,TrunkFor,WorktreeTrunks, and register/unregister methods. Trunk checks throughout the state and branch-graph layers now treat every registered worktree trunk as a graph root, so traversals (Downstack,Bottom, tx path-finding) stop at them and a branch may be stacked directly on a worktree trunk.Add
-w/--worktreetolog shortandrepo restackto scope operations to stacks with at least one branch checked out in the current worktree, backed byBranchGraph.StacksInWorktree.syncpulls the canonical remote trunk into the worktree's local trunk.repo restackgainsSkipCheckoutand handles checkout itself.Includes unit tests for the trunk registry and graph roots, plus test scripts covering worktree create/list, the
-wfilters, and branch create/restack when trunk is checked out elsewhere.