Expand description
sley-submodule — shared submodule engine for sley.
Centralizes two pieces of submodule logic that git keeps in
submodule-config.c and submodule.c, and that sley previously scattered
across the 1850-line submodule CLI command and ~14 ad-hoc .gitmodules
walks:
config— typed.gitmodulesparsing (submodule-config.c): aconfig::SubmoduleConfigSetof typedconfig::Submoduleentries, plus thecheck_submodule_name/check_submodule_urlsecurity checks and the recurse-mode / update-strategy enums.- [
relative_url] — the.gitmodules-url → concrete-url resolution (remote.c::relative_url+submodule--helper.c::resolve_relative_url).submodule init/sync/addall route their relative-url math through this one primitive so every git URL form (ssh, scp-style, file://, helper, relative local path) resolves byte-for-byte the way upstream does. update_strategy— thesubmodule updatemode resolver (submodule--helper.c::determine_submodule_update_strategy): picks ONE of checkout/merge/rebase/command/none from the CLI-flag →.git/config→.gitmodules→ default-checkout precedence, with thejust_cloneddowngrade.submodule updateroutes every mode through this one resolver.move_head— the move-head / verify-clean primitives (submodule.c::submodule_move_headdry-run path + theunpack-trees.cwrapperscheck_submodule_move_head/verify_clean_submodule). These are the hooks the tree-switch (unpack-trees) engine calls to decide whether a HEAD move would lose submodule work.
The two halves are paired on purpose: a tree-switch needs the typed config (to know which paths are submodules and their bindings) AND the move-head check (to know whether moving each one is safe).
Re-exports§
pub use config::ParseWarning;pub use config::RecurseMode;pub use config::Submodule;pub use config::SubmoduleConfigSet;pub use config::UpdateStrategy;pub use config::UpdateType;pub use config::check_submodule_name;pub use config::check_submodule_url;pub use config::looks_like_command_line_option;pub use config::parse_fetch_recurse;pub use config::parse_update_strategy;pub use config::parse_update_type;pub use config::update_type_to_string;pub use move_head::MoveHeadContext;pub use move_head::MoveHeadFlags;pub use move_head::MoveHeadVerdict;pub use move_head::check_move_head;pub use move_head::check_submodule_move_head;pub use move_head::verify_clean_submodule;pub use relative_url::relative_url;pub use relative_url::resolve_relative_url;pub use update_strategy::determine_update_strategy;
Modules§
- config
- Typed
.gitmodulesconfiguration — a Rust port of git’ssubmodule-config.c. - move_
head - Submodule move-head / verify-clean primitives — a Rust port of the
verification half of git’s
submodule.c::submodule_move_headplus theunpack-trees.cwrapperscheck_submodule_move_headandverify_clean_submodule. - relative_
url - Relative submodule URL resolution — a Rust port of git’s
remote.crelative_urland its helpers (chop_last_dir,url_is_local_not_ssh,is_absolute_path). - update_
strategy - Submodule update-strategy resolution — a Rust port of git’s
builtin/submodule--helper.c::determine_submodule_update_strategyplus the per-strategy execution dispatch (run_update_command).