Skip to main content

verify_clean_submodule

Function verify_clean_submodule 

Source
pub fn verify_clean_submodule(
    is_submodule: bool,
    ctx: &MoveHeadContext,
    old_sha1: Option<&str>,
    new_oid_hex: &str,
    reset: bool,
) -> MoveHeadVerdict
Expand description

Port of verify_clean_submodule (git unpack-trees.c). Checks that checking out ce’s oid in the submodule subdir won’t overwrite working files, given the submodule’s current head (old_sha1, None when HEAD is unresolved).

In git this is literally check_submodule_move_head(ce, old_sha1, oid_to_hex(&ce->oid), o) with the same submodule_from_ce short-circuit.