History

[commitgraph] refactor

Sebastian Thiel committed 6 years ago

Commit c4b14c11 parent 6f90bee4 files · +18 −18Browse files

Showing the changes to git-commitgraph/src/graph (1 of 4 files). Show all

Unified · Split

git-commitgraph/src/graph/access.rs+7−7
@@ -8,17 +8,17 @@ use git_object::borrowed; · 7 unmodified lines
88 impl Graph {
99 pub fn commit_at(&self, pos: graph::Position) -> Commit<'_> {
1010 let r = self.lookup_by_pos(pos);
11− r.file.commit_at(r.lex_pos)
11+ r.file.commit_at(r.pos)
1212 }
1313
1414 pub fn commit_by_id(&self, id: borrowed::Id<'_>) -> Option<Commit<'_>> {
1515 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))
1717 }
1818
1919 pub fn id_at(&self, pos: graph::Position) -> borrowed::Id<'_> {
2020 let r = self.lookup_by_pos(pos);
21− r.file.id_at(r.lex_pos)
21+ r.file.id_at(r.pos)
2222 }
2323
2424 /// Iterate over commits in unsorted order.
@@ -48,7 +48,7 @@ impl Graph { · 23 unmodified lines
4848 if let Some(lex_pos) = file.lookup(id) {
4949 return Some(LookupByIdResult {
5050 file,
51− lex_pos,
51+ file_pos: lex_pos,
5252 graph_pos: graph::Position(current_file_start + lex_pos.0),
5353 });
5454 }
@@ -65,7 +65,7 @@ impl Graph { · 10 unmodified lines
6565 None => {
6666 return LookupByPositionResult {
6767 file,
68− lex_pos: file::Position(remaining),
68+ pos: file::Position(remaining),
6969 }
7070 }
7171 }
@@ -78,11 +78,11 @@ impl Graph { · 6 unmodified lines
7878 struct LookupByIdResult<'a> {
7979 pub file: &'a File,
8080 pub graph_pos: graph::Position,
81− pub lex_pos: file::Position,
81+ pub file_pos: file::Position,
8282 }
8383
8484 #[derive(Clone)]
8585 struct LookupByPositionResult<'a> {
8686 pub file: &'a File,
87− pub lex_pos: file::Position,
87+ pub pos: file::Position,
8888 }