Skip to main content

build_commit_graph

Function build_commit_graph 

Source
pub fn build_commit_graph(
    repo: &Repository,
    opts: &CommitGraphOptions,
) -> Result<CommitGraphBuild>
Expand description

Build a reachable commit-graph in memory, for any object store.

Reachable commits are discovered from Repository::refs and read through Repository::odb, so this works for a custom primary (crate::odb::OdbBuilder::primary) as well as the files backend. Nothing is written: a custom store persists BuiltCommitGraph::bytes in its own storage and attaches the graph when it next opens the repository, with OdbBuilder::commit_graph and CommitGraphChain::from_bytes. For a files-backed repository write_commit_graph builds the same bytes and installs them under objects/info/.

With CommitGraphOptions::changed_paths, changed-path Bloom filters are added, reusing the filters of the graph the repository’s walks already use (the attached graph, or the files backend’s on-disk graph) where their settings match. CommitGraphOptions::dry_run has no effect. In a shallow repository, with info/grafts, or with enabled replace refs, CommitGraphBuild::Skipped says why no graph was built (see CommitGraphSkipReason).

§Errors

Propagates ref, object read and config errors.