Expand description
Submodule update-strategy resolution — a Rust port of git’s
builtin/submodule--helper.c::determine_submodule_update_strategy plus the
per-strategy execution dispatch (run_update_command).
submodule update must, for each selected submodule, pick exactly ONE update
mode and run it against the gitlink oid recorded in the superproject index.
git resolves the mode from a fixed precedence:
- the command-line
--checkout/--merge/--rebaseflag (theupdatedefault passed intoupdate_submodule), if any; - else
.git/config submodule.<name>.update; - else the
.gitmodules submodule.<name>.updatevalue parsed into the typedUpdateStrategy(but NOT a!command— git BUG()s if it ever reads a command out of.gitmodules, becauseinitrefuses to copy one); - else
UpdateType::Checkout.
Then a just_cloned submodule downgrades merge/rebase/none to
checkout (there is no local HEAD to merge/rebase onto yet).
Centralizing this here means the CLI’s submodule update routes every mode
through one resolver + one dispatch, so the whole update CLASS (checkout,
merge, rebase, command, none-skip) converges on a single code path instead of
the old checkout-only special case.
Functions§
- determine_
update_ strategy - Port of
determine_submodule_update_strategy. Resolves the effective update strategy for one submodule from the precedence above.