Showing the changes to git-commitgraph/src (3 of 4 files). Show all
Unified · Split
| @@ -8,7 +8,7 @@ use std::{ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | /// Access |
| 10 | 10 | impl File { |
| 11 | − /// Returns the commit data for the commit located at the given lex position. | |
| 11 | + /// Returns the commit data for the commit located at the given lexigraphical position. | |
| 12 | 12 | /// |
| 13 | 13 | /// `pos` must range from 0 to self.num_commits(). |
| 14 | 14 | /// |
| @@ -23,13 +23,13 @@ impl File { · 8 unmodified lines | ||
| 23 | 23 | HashKind::Sha1 |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | − // copied from git-odb/src/pack/index/access.rs | |
| 27 | 26 | /// Returns 20 bytes sha1 at the given index in our list of (sorted) sha1 hashes. |
| 28 | 27 | /// The position ranges from 0 to self.num_commits() |
| 28 | + // copied from git-odb/src/pack/index/access.rs | |
| 29 | 29 | pub fn id_at(&self, pos: file::Position) -> borrowed::Id<'_> { |
| 30 | 30 | assert!( |
| 31 | 31 | pos.0 < self.num_commits(), |
| 32 | − "expected lex position less than {}, got {}", | |
| 32 | + "expected lexigraphical position less than {}, got {}", | |
| 33 | 33 | self.num_commits(), |
| 34 | 34 | pos.0 |
| 35 | 35 | ); |
| @@ -85,7 +85,7 @@ impl File { · 49 unmodified lines | ||
| 85 | 85 | |
| 86 | 86 | /// Returns the number of commits in this graph file. |
| 87 | 87 | /// |
| 88 | − /// The maximum valid `Lexfile::Position` that can be used with this file is one less than | |
| 88 | + /// The maximum valid `file::Position` that can be used with this file is one less than | |
| 89 | 89 | /// `num_commits()`. |
| 90 | 90 | pub fn num_commits(&self) -> u32 { |
| 91 | 91 | self.fan[255] |
| @@ -101,7 +101,7 @@ impl File { · 9 unmodified lines | ||
| 101 | 101 | pub(crate) fn commit_data_bytes(&self, pos: file::Position) -> &[u8] { |
| 102 | 102 | assert!( |
| 103 | 103 | pos.0 < self.num_commits(), |
| 104 | − "expected lex position less than {}, got {}", | |
| 104 | + "expected lexigraphical position less than {}, got {}", | |
| 105 | 105 | self.num_commits(), |
| 106 | 106 | pos.0 |
| 107 | 107 | ); |
| @@ -45,7 +45,7 @@ const EXTENDED_EDGES_MASK: u32 = 0x8000_0000; · 44 unmodified lines | ||
| 45 | 45 | |
| 46 | 46 | pub struct Commit<'a> { |
| 47 | 47 | file: &'a File, |
| 48 | − lex_pos: file::Position, | |
| 48 | + pos: file::Position, | |
| 49 | 49 | // We can parse the below fields lazily if needed. |
| 50 | 50 | commit_timestamp: u64, |
| 51 | 51 | generation: u32, |
| @@ -59,7 +59,7 @@ impl<'a> Commit<'a> { · 7 unmodified lines | ||
| 59 | 59 | let bytes = file.commit_data_bytes(pos); |
| 60 | 60 | Commit { |
| 61 | 61 | file, |
| 62 | − lex_pos: pos, | |
| 62 | + pos, | |
| 63 | 63 | root_tree_id: borrowed::Id::try_from(&bytes[..SHA1_SIZE]).expect("20 bytes SHA1 to be alright"), |
| 64 | 64 | parent1: ParentEdge::from_raw(BigEndian::read_u32(&bytes[SHA1_SIZE..SHA1_SIZE + 4])), |
| 65 | 65 | parent2: ParentEdge::from_raw(BigEndian::read_u32(&bytes[SHA1_SIZE + 4..SHA1_SIZE + 8])), |
| @@ -94,7 +94,7 @@ impl<'a> Commit<'a> { · 28 unmodified lines | ||
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | pub fn id(&self) -> borrowed::Id<'_> { |
| 97 | − self.file.id_at(self.lex_pos) | |
| 97 | + self.file.id_at(self.pos) | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | pub fn parent1(&self) -> Result<Option<graph::Position>, Error> { |
| @@ -112,7 +112,7 @@ impl<'a> Debug for Commit<'a> { · 11 unmodified lines | ||
| 112 | 112 | f, |
| 113 | 113 | "Commit {{ id: {}, lex_pos: {}, generation: {}, root_tree_id: {}, parent1: {:?}, parent2: {:?} }}", |
| 114 | 114 | self.id(), |
| 115 | − self.lex_pos, | |
| 115 | + self.pos, | |
| 116 | 116 | self.generation(), |
| 117 | 117 | self.root_tree_id(), |
| 118 | 118 | self.parent1, |
| @@ -125,7 +125,7 @@ impl<'a> Eq for Commit<'a> {} · 6 unmodified lines | ||
| 125 | 125 | |
| 126 | 126 | impl<'a> PartialEq for Commit<'a> { |
| 127 | 127 | fn eq(&self, other: &Self) -> bool { |
| 128 | − self.file as *const File == other.file as *const File && self.lex_pos == other.lex_pos | |
| 128 | + self.file as *const File == other.file as *const File && self.pos == other.pos | |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
| @@ -8,17 +8,17 @@ use git_object::borrowed; · 7 unmodified lines | ||
| 8 | 8 | impl Graph { |
| 9 | 9 | pub fn commit_at(&self, pos: graph::Position) -> Commit<'_> { |
| 10 | 10 | let r = self.lookup_by_pos(pos); |
| 11 | − r.file.commit_at(r.lex_pos) | |
| 11 | + r.file.commit_at(r.pos) | |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | pub fn commit_by_id(&self, id: borrowed::Id<'_>) -> Option<Commit<'_>> { |
| 15 | 15 | let r = self.lookup_by_id(id)?; |
| 16 | − Some(r.file.commit_at(r.lex_pos)) | |
| 16 | + Some(r.file.commit_at(r.file_pos)) | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | pub fn id_at(&self, pos: graph::Position) -> borrowed::Id<'_> { |
| 20 | 20 | let r = self.lookup_by_pos(pos); |
| 21 | − r.file.id_at(r.lex_pos) | |
| 21 | + r.file.id_at(r.pos) | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /// Iterate over commits in unsorted order. |
| @@ -48,7 +48,7 @@ impl Graph { · 23 unmodified lines | ||
| 48 | 48 | if let Some(lex_pos) = file.lookup(id) { |
| 49 | 49 | return Some(LookupByIdResult { |
| 50 | 50 | file, |
| 51 | − lex_pos, | |
| 51 | + file_pos: lex_pos, | |
| 52 | 52 | graph_pos: graph::Position(current_file_start + lex_pos.0), |
| 53 | 53 | }); |
| 54 | 54 | } |
| @@ -65,7 +65,7 @@ impl Graph { · 10 unmodified lines | ||
| 65 | 65 | None => { |
| 66 | 66 | return LookupByPositionResult { |
| 67 | 67 | file, |
| 68 | − lex_pos: file::Position(remaining), | |
| 68 | + pos: file::Position(remaining), | |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | } |
| @@ -78,11 +78,11 @@ impl Graph { · 6 unmodified lines | ||
| 78 | 78 | struct LookupByIdResult<'a> { |
| 79 | 79 | pub file: &'a File, |
| 80 | 80 | pub graph_pos: graph::Position, |
| 81 | − pub lex_pos: file::Position, | |
| 81 | + pub file_pos: file::Position, | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | #[derive(Clone)] |
| 85 | 85 | struct LookupByPositionResult<'a> { |
| 86 | 86 | pub file: &'a File, |
| 87 | − pub lex_pos: file::Position, | |
| 87 | + pub pos: file::Position, | |
| 88 | 88 | } |