Skip to main content

Module submodule

Module submodule 

Source
Expand description

Git submodule detection and initialization (issue #50).

git submodule status is a sanctioned subprocess read (spec §4); the parser lives in porcelain. Initialization is a mutating/network operation, so it goes through the git CLI. Both run against a worktree directory: a freshly created worktree (or one switched to a branch that adds submodules) reports its submodules as uninitialized until update --init populates them.

Functions§

uninitialized
Returns the paths of submodules that are defined but not yet initialized in worktree_dir (the - marker of git submodule status). Best-effort: a repo with no submodules, or a directory where the command cannot run, yields an empty list rather than an error, so callers can treat “no submodules” and “could not tell” alike.
update_init
Initializes and updates all submodules in worktree_dir, recursively (git submodule update --init --recursive). Propagates a subprocess error; callers decide whether that is fatal.