History

git-commitgraph uses `oid` now (#63)

Sebastian Thiel committed 5 years ago

Commit 0b729661 parent 3930a6f6 files · +35 −46Browse files

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

Unified · Split

git-commitgraph/src/graph/access.rs+5−5
@@ -15,7 +15,7 @@ impl Graph { · 14 unmodified lines
1515 }
1616
1717 /// Returns the commit matching the given `id`.
18− pub fn commit_by_id(&self, id: git_hash::borrowed::Id<'_>) -> Option<Commit<'_>> {
18+ pub fn commit_by_id(&self, id: &git_hash::oid) -> Option<Commit<'_>> {
1919 let r = self.lookup_by_id(id)?;
2020 Some(r.file.commit_at(r.file_pos))
2121 }
@@ -24,7 +24,7 @@ impl Graph { · 2 unmodified lines
2424 ///
2525 /// # Panics
2626 /// If `pos` is greater or equal to [`num_commits()`][Graph::num_commits()].
27− pub fn id_at(&self, pos: graph::Position) -> git_hash::borrowed::Id<'_> {
27+ pub fn id_at(&self, pos: graph::Position) -> &git_hash::oid {
2828 let r = self.lookup_by_pos(pos);
2929 r.file.id_at(r.pos)
3030 }
@@ -35,12 +35,12 @@ impl Graph { · 4 unmodified lines
3535 }
3636
3737 /// Iterate over commit IDs in unsorted order.
38− pub fn iter_ids(&self) -> impl Iterator<Item = git_hash::borrowed::Id<'_>> {
38+ pub fn iter_ids(&self) -> impl Iterator<Item = &git_hash::oid> {
3939 self.files.iter().flat_map(|file| file.iter_ids())
4040 }
4141
4242 /// Translate the given `id` to its position in the file.
43− pub fn lookup(&self, id: git_hash::borrowed::Id<'_>) -> Option<graph::Position> {
43+ pub fn lookup(&self, id: &git_hash::oid) -> Option<graph::Position> {
4444 Some(self.lookup_by_id(id)?.graph_pos)
4545 }
4646
@@ -52,7 +52,7 @@ impl Graph { · 5 unmodified lines
5252
5353 /// Access fundamentals
5454 impl Graph {
55− pub(crate) fn lookup_by_id(&self, id: git_hash::borrowed::Id<'_>) -> Option<LookupByIdResult<'_>> {
55+ pub(crate) fn lookup_by_id(&self, id: &git_hash::oid) -> Option<LookupByIdResult<'_>> {
5656 let mut current_file_start = 0;
5757 for file in &self.files {
5858 if let Some(lex_pos) = file.lookup(id) {