gix_revision::merge_base

Function octopus

Source
pub fn octopus(
    first: ObjectId,
    others: &[ObjectId],
    graph: &mut Graph<'_, '_, Commit<Flags>>,
) -> Result<Option<ObjectId>, Error>
Available on crate feature merge_base only.
Expand description

Given a commit at first id, traverse the commit graph and return the best common ancestor between it and others, sorted from best to worst. Returns None if there is no common merge-base as first and others don’t all share history. If others is empty, Some(first) is returned.

§Performance

For repeated calls, be sure to re-use graph as its content will be kept and reused for a great speed-up. The contained flags will automatically be cleared.