Struct gix_commitgraph::Graph
source · pub struct Graph { /* private fields */ }
Expand description
A complete commit graph.
The data in the commit graph may come from a monolithic objects/info/commit-graph
file, or it
may come from one or more objects/info/commit-graphs/graph-*.graph
files. These files are
generated via git commit-graph write ...
commands.
Implementations§
source§impl Graph
impl Graph
Access
sourcepub fn commit_by_id(&self, id: impl AsRef<oid>) -> Option<Commit<'_>>
pub fn commit_by_id(&self, id: impl AsRef<oid>) -> Option<Commit<'_>>
Returns the commit matching the given id
.
sourcepub fn iter_commits(&self) -> impl Iterator<Item = Commit<'_>>
pub fn iter_commits(&self) -> impl Iterator<Item = Commit<'_>>
Iterate over commits in unsorted order.
sourcepub fn iter_ids(&self) -> impl Iterator<Item = &oid>
pub fn iter_ids(&self) -> impl Iterator<Item = &oid>
Iterate over commit IDs in unsorted order.
sourcepub fn lookup(&self, id: impl AsRef<oid>) -> Option<Position>
pub fn lookup(&self, id: impl AsRef<oid>) -> Option<Position>
Translate the given id
to its position in the file.
sourcepub fn num_commits(&self) -> u32
pub fn num_commits(&self) -> u32
Returns the number of commits stored in this file.
source§impl Graph
impl Graph
Instantiate a Graph
from various sources.
sourcepub fn at(path: &Path) -> Result<Self, Error>
pub fn at(path: &Path) -> Result<Self, Error>
Instantiate a commit graph from path
which may be a directory containing graph files or the graph file itself.
sourcepub fn from_commit_graphs_dir(path: &Path) -> Result<Self, Error>
pub fn from_commit_graphs_dir(path: &Path) -> Result<Self, Error>
Instantiate a commit graph from the directory containing all of its files.
sourcepub fn from_file(path: &Path) -> Result<Self, Error>
pub fn from_file(path: &Path) -> Result<Self, Error>
Instantiate a commit graph from a .git/objects/info/commit-graph
or
.git/objects/info/commit-graphs/graph-*.graph
file.
sourcepub fn from_info_dir(info_dir: &Path) -> Result<Self, Error>
pub fn from_info_dir(info_dir: &Path) -> Result<Self, Error>
Instantiate a commit graph from an .git/objects/info
directory.
source§impl Graph
impl Graph
sourcepub fn verify_integrity<E>(
&self,
processor: impl FnMut(&Commit<'_>) -> Result<(), E>,
) -> Result<Outcome, Error<E>>where
E: Error + 'static,
pub fn verify_integrity<E>(
&self,
processor: impl FnMut(&Commit<'_>) -> Result<(), E>,
) -> Result<Outcome, Error<E>>where
E: Error + 'static,
Traverse all commits in the graph and call processor(&commit) -> Result<(), E>
on it while verifying checksums.
When processor
returns an error, the entire verification is stopped and the error returned.