Skip to content

feat(submodule): track and manage submodule branch associations#1178

Draft
ed-irl wants to merge 4 commits into
ed-irl/restack-options-paramfrom
ed-irl/submodule-tracking
Draft

feat(submodule): track and manage submodule branch associations#1178
ed-irl wants to merge 4 commits into
ed-irl/restack-options-paramfrom
ed-irl/submodule-tracking

Conversation

@ed-irl

@ed-irl ed-irl commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Record which branch each submodule is on when a parent commit is made, and surface those associations in the branch log and through new management commands.

New commands:

  • gs branch submodule list shows the submodule branch associations recorded for a branch (defaults to the current branch).
  • gs branch submodule repoint <path> changes the submodule branch associated with the current parent branch, defaulting to the submodule's current branch.

Automatic tracking:

  • branch create, commit create, and commit amend record each non-excluded submodule's current branch via a new SubmoduleTracker. Detached-HEAD submodules are skipped, and recording failures only warn.
  • spice.submodule.exclude lists submodule paths to skip.

Display:

  • gs ls and gs ll render associations as [path:branch]; the JSON log adds a submodules field.

State:

  • branchState gains an additive, optional submodules map. UpsertRequest.Submodules merges into existing state: non-empty values set an entry, empty strings remove one, and nil leaves it unchanged.

Git layer:

  • Add Worktree.Submodules, SubmoduleCurrentBranch, SubmoduleWorktree, and UpdateSubmodulePointer.
  • Fix LocalBranches to resolve the real worktree path for submodules with absorbed gitdirs, where git reports %(worktreepath) as the gitdir; previously this caused restacks inside a submodule to be skipped as "checked out in another worktree".

@ed-irl ed-irl force-pushed the ed-irl/submodule-tracking branch 4 times, most recently from 44671b8 to dfe2d2f Compare June 8, 2026 10:18
@ed-irl ed-irl force-pushed the ed-irl/submodule-tracking branch 3 times, most recently from 16e21bf to 217bc45 Compare June 15, 2026 09:51
@ed-irl ed-irl changed the title submodule: add tracking commands and fix absorbed-gitdir worktree resolution feat(worktree): add worktree management commands and per-worktree trunks Jun 19, 2026
@ed-irl ed-irl force-pushed the ed-irl/submodule-tracking branch from 100dd73 to 355164e Compare June 19, 2026 00:58
@ed-irl ed-irl changed the title feat(worktree): add worktree management commands and per-worktree trunks feat(submodule): track and manage submodule branch associations Jun 19, 2026
ed-irl and others added 3 commits June 23, 2026 11:38
Introduces restack.Options{AutoResolve} and threads an opts *Options
parameter through the high-level restack entry points (RestackBranch,
RestackStack, RestackDownstack) and the merge/sync RestackHandler
interfaces, with all current callers passing nil.

This is foundational plumbing for the restack auto-resolve feature.
Landing it on a branch below the consuming stacks lets every branch
inherit the 3-arg signature, rather than the signature change living
on a branch parallel to its callers.
@ed-irl ed-irl changed the base branch from main to ed-irl/restack-options-param June 24, 2026 01:31
@ed-irl ed-irl force-pushed the ed-irl/submodule-tracking branch from 355164e to 473b7dd Compare June 24, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant