pub fn merge_base(
first: ObjectId,
others: &[ObjectId],
graph: &mut Graph<'_, '_, Commit<Flags>>,
) -> Result<Option<Vec<ObjectId>>, Error>
merge_base
only.Expand description
Given a commit at first
id, traverse the commit graph
and return all possible merge-base between it and others
,
sorted from best to worst. Returns None
if there is no merge-base as first
and others
don’t share history.
If others
is empty, Some(first)
is returned.
Note that this function doesn’t do any work if first
is contained in others
, which is when first
will be returned
as only merge-base right away. This is even the case if some commits of others
are disjoint.
Additionally, this function isn’t stable and results may differ dependeing on the order in which first
and others
are
provided due to its special rules.
If a stable result is needed, use merge_base::octopus()
.
§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.