* Use "number of" phrasing instead of "amount of." * Describe the graph as an index instead of a cache. * Add module-level documentation for `file::commit`, `file::verify`, and `graph::verify`.
Showing the changes to git-commitgraph/src/graph (3 of 8 files). Show all
Unified · Split
| @@ -45,7 +45,7 @@ impl Graph { · 44 unmodified lines | ||
| 45 | 45 | Some(self.lookup_by_id(id)?.graph_pos) |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | − /// Returns the amount of commits stored in this file. | |
| 48 | + /// Returns the number of commits stored in this file. | |
| 49 | 49 | pub fn num_commits(&self) -> u32 { |
| 50 | 50 | self.files.iter().map(|f| f.num_commits()).sum() |
| 51 | 51 | } |
| @@ -1,7 +1,6 @@ | ||
| 1 | 1 | //! Operations on a complete commit graph. |
| 2 | 2 | mod access; |
| 3 | 3 | mod init; |
| 4 | −/// | |
| 5 | 4 | pub mod verify; |
| 6 | 5 | |
| 7 | 6 | use crate::file::File; |
| @@ -1,3 +1,4 @@ | ||
| 1 | +//! Auxiliary types used by graph verification methods. | |
| 1 | 2 | use crate::{ |
| 2 | 3 | file::{self, commit}, |
| 3 | 4 | graph, Graph, GENERATION_NUMBER_MAX, |
| @@ -50,17 +51,19 @@ pub enum Error<E: std::error::Error + 'static> { · 46 unmodified lines | ||
| 50 | 51 | TooManyFiles(usize), |
| 51 | 52 | } |
| 52 | 53 | |
| 53 | −/// Statistics gathered while verifying the integrity of the graph as returned by [`Graph::verify_integrity()]`. | |
| 54 | +/// Statistics gathered while verifying the integrity of the graph as returned by [`Graph::verify_integrity()`]. | |
| 54 | 55 | #[derive(Clone, Debug, Eq, PartialEq)] |
| 55 | 56 | #[cfg_attr(feature = "serde1", derive(serde::Deserialize, serde::Serialize))] |
| 56 | 57 | pub struct Outcome { |
| 57 | − /// The longest consecutive amount of commits in a chain of commits. | |
| 58 | + /// The length of the longest path between any two commits in this graph. | |
| 58 | 59 | /// |
| 59 | − /// For example, a repository with 10 commits would have 10 as value. | |
| 60 | + /// For example, this will be `Some(9)` for a commit graph containing 10 linear commits. | |
| 61 | + /// This will be `Some(0)` for a commit graph containing 0 or 1 commits. | |
| 62 | + /// If the longest path length is too large to fit in a [u32], then this will be [None]. | |
| 60 | 63 | pub longest_path_length: Option<u32>, |
| 61 | − /// The total amount traversed commits. | |
| 64 | + /// The total number of commits traversed. | |
| 62 | 65 | pub num_commits: u32, |
| 63 | − /// A mapping of `parent-count -> amount of [commits][file::Commit] with that count`. | |
| 66 | + /// A mapping of `N -> number of commits with N parents`. | |
| 64 | 67 | pub parent_counts: BTreeMap<u32, u32>, |
| 65 | 68 | } |
| 66 | 69 | |