Showing the changes to git-commitgraph/src/graph (1 of 4 files). Show all
Unified · Split
| @@ -8,17 +8,17 @@ use git_object::borrowed; · 7 unmodified lines | |||
| 8 | impl Graph { | 8 | impl Graph { |
| 9 | pub fn commit_at(&self, pos: graph::Position) -> Commit<'_> { | 9 | pub fn commit_at(&self, pos: graph::Position) -> Commit<'_> { |
| 10 | let r = self.lookup_by_pos(pos); | 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 | pub fn commit_by_id(&self, id: borrowed::Id<'_>) -> Option<Commit<'_>> { | 14 | pub fn commit_by_id(&self, id: borrowed::Id<'_>) -> Option<Commit<'_>> { |
| 15 | let r = self.lookup_by_id(id)?; | 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 | pub fn id_at(&self, pos: graph::Position) -> borrowed::Id<'_> { | 19 | pub fn id_at(&self, pos: graph::Position) -> borrowed::Id<'_> { |
| 20 | let r = self.lookup_by_pos(pos); | 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 | /// Iterate over commits in unsorted order. | 24 | /// Iterate over commits in unsorted order. |
| @@ -48,7 +48,7 @@ impl Graph { · 23 unmodified lines | |||
| 48 | if let Some(lex_pos) = file.lookup(id) { | 48 | if let Some(lex_pos) = file.lookup(id) { |
| 49 | return Some(LookupByIdResult { | 49 | return Some(LookupByIdResult { |
| 50 | file, | 50 | file, |
| 51 | lex_pos, | 51 | file_pos: lex_pos, |
| 52 | graph_pos: graph::Position(current_file_start + lex_pos.0), | 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 | None => { | 65 | None => { |
| 66 | return LookupByPositionResult { | 66 | return LookupByPositionResult { |
| 67 | file, | 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 | struct LookupByIdResult<'a> { | 78 | struct LookupByIdResult<'a> { |
| 79 | pub file: &'a File, | 79 | pub file: &'a File, |
| 80 | pub graph_pos: graph::Position, | 80 | pub graph_pos: graph::Position, |
| 81 | pub lex_pos: file::Position, | 81 | pub file_pos: file::Position, |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | #[derive(Clone)] | 84 | #[derive(Clone)] |
| 85 | struct LookupByPositionResult<'a> { | 85 | struct LookupByPositionResult<'a> { |
| 86 | pub file: &'a File, | 86 | pub file: &'a File, |
| 87 | pub lex_pos: file::Position, | 87 | pub pos: file::Position, |
| 88 | } | 88 | } |