Skip to content

Commit d2eec1d

Browse files
committed
[commitgraph] refactor graph::init module
1 parent 3c8640e commit d2eec1d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

git-commitgraph/src/graph/init.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ quick_error! {
3939
}
4040
}
4141

42+
/// Instantiate a `Graph` from various sources
4243
impl Graph {
4344
pub fn from_info_dir(info_dir: impl AsRef<Path>) -> Result<Self, Error> {
4445
Self::from_single_file(info_dir.as_ref())
@@ -55,11 +56,10 @@ impl Graph {
5556
let commit_graphs_dir = commit_graphs_dir.as_ref();
5657
let chain_file_path = commit_graphs_dir.join("commit-graph-chain");
5758
let chain_file = std::fs::File::open(&chain_file_path).map_err(|e| Error::Io(e, chain_file_path.clone()))?;
58-
let mut files: Vec<File> = Vec::new();
59+
let mut files = Vec::new();
5960
for line in BufReader::new(chain_file).lines() {
60-
let line = line.map_err(|e| Error::Io(e, chain_file_path.clone()))?;
61-
let graph_filename = format!("graph-{}.graph", line);
62-
let graph_file_path = commit_graphs_dir.join(graph_filename);
61+
let hash = line.map_err(|e| Error::Io(e, chain_file_path.clone()))?;
62+
let graph_file_path = commit_graphs_dir.join(format!("graph-{}.graph", hash));
6363
files.push(File::at(&graph_file_path).map_err(|e| Error::File(e, graph_file_path.clone()))?);
6464
}
6565
Self::new(files)

0 commit comments

Comments
 (0)