Skip to content

Submodule support: tracking, checkout, commit, and recursive operations #1246

Description

@ed-irl-codebot

Problem

git-spice has no awareness of Git submodules. Stacks that change a
submodule pointer can't track which submodule branch a parent commit
expects, there is no help checking out or committing the right
submodule state, and recursive operations across a superproject and its
submodules aren't supported. There is also a latent bug: inside a
submodule with an absorbed gitdir, git-spice mis-resolves the worktree
path and treats every branch as "checked out in another worktree,"
breaking restack and sync.

Proposal

Add submodule support, layered from a tracking baseline up to recursive
operations:

  • Tracking + commands: a Submodules map on each tracked branch in
    the store; git-layer listing from .gitmodules, current-branch and
    worktree resolution, and pointer updates; a submodule.Tracker with
    exclusion via spice.submodule.exclude; commit-time recording of the
    per-submodule branch on the parent; gs branch submodule list /
    repoint commands; and [path:branch] annotations in gs ls/ll.
    Also fixes the absorbed-gitdir worktree-path resolution bug.
  • Primitives: building blocks for transactional checkout and
    recursive operations.
  • Auto behaviors: auto-checkout, branch-create inheritance, and
    branch-fold merge for submodules.
  • Commit integration: auto-commit and gitlink pointer updates on
    parent commits.
  • Recursive ops: gs repo init --recurse-submodules and
    --recurse-submodules for gs stack restack.

Tracked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions