Skip to main content

write_commit_graph

Function write_commit_graph 

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

Write a monolithic reachable commit-graph under objects/info/commit-graph.

Reachable commits are discovered from Repository::refs (reftable, packed-refs, and linked-worktree visibility), not by scanning git_dir/refs alone.

In a shallow repository, with info/grafts, or with enabled replace refs, nothing is written and CommitGraphWriteReport::skipped says why (see CommitGraphSkipReason). Git only skips the write in that state, but git fsck still verifies a graph that is already there, so an existing graph and split chain are deleted as well (except in CommitGraphOptions::dry_run).

ยงErrors

Returns Error::UnsupportedObjectStore for non-files ODB backends, or errors from graph generation and atomic I/O.