History

[commitgraph] Add `Graph::at` constructor.

This constructor tries to accept as many commit-graph-looking paths as possible, such as `.git/objects/info`, `.git/objects/info/commit-graph`, or `.git/objects/info/commit-graphs`.

Conor Davis committed 6 years ago

Commit a7830521 parent 1b738ac2 files · +44 −16Browse files

Showing the changes to gitoxide-core/src/commitgraph (1 of 2 files). Show all

Unified · Split

gitoxide-core/src/commitgraph/verify.rs+2−1
@@ -1,4 +1,5 @@
11 use anyhow::{Context as AnyhowContext, Result};
2+use git_commitgraph::Graph;
23 use std::{io, path::Path};
34
45 /// A general purpose context for many operations provided here
@@ -31,6 +32,6 @@ where · 26 unmodified lines
3132 {
3233 // TODO: Handle `path` being objects/info, objects/info/commit-graph,
3334 // or objects/info/commit-graphs/graph-xyz.graph.
34− let _g = git_commitgraph::Graph::from_info_dir(path).with_context(|| "Could not open commit graph")?;
35+ let _g = Graph::at(path).with_context(|| "Could not open commit graph")?;
3536 Err(anyhow::Error::msg("not implemented"))
3637 }