Skip to main content

is_ancestor

Function is_ancestor 

Source
pub fn is_ancestor(
    root: &Path,
    ancestor: &str,
    descendant: &str,
) -> Option<bool>
Expand description

Is ancestor reachable from descendant? None when git cannot answer at all — a missing executable, a commit this clone does not have — which is a third answer and not a false: “not an ancestor” and “unknown ancestry” lead a reader to different actions, and collapsing them is how a record from a rewritten history gets read as current.

Exposed rather than left to run because ancestry is the one git question the divergence label depends on, and a caller that had the whole command runner in order to ask it could ask anything.