Showing the changes to git-commitgraph/src/graph (1 of 1 file). Show all
Unified · Split
| @@ -39,6 +39,7 @@ quick_error! { · 38 unmodified lines | ||
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | +/// Instantiate a `Graph` from various sources | |
| 42 | 43 | impl Graph { |
| 43 | 44 | pub fn from_info_dir(info_dir: impl AsRef<Path>) -> Result<Self, Error> { |
| 44 | 45 | Self::from_single_file(info_dir.as_ref()) |
| @@ -55,11 +56,10 @@ impl Graph { · 10 unmodified lines | ||
| 55 | 56 | let commit_graphs_dir = commit_graphs_dir.as_ref(); |
| 56 | 57 | let chain_file_path = commit_graphs_dir.join("commit-graph-chain"); |
| 57 | 58 | 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(); | |
| 59 | 60 | 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)); | |
| 63 | 63 | files.push(File::at(&graph_file_path).map_err(|e| Error::File(e, graph_file_path.clone()))?); |
| 64 | 64 | } |
| 65 | 65 | Self::new(files) |