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/file/commit.rs (1 of 6 files). Show all

Unified · Split

git-commitgraph/src/file/commit.rs+5−5
@@ -6,7 +6,7 @@ use crate::{ · 5 unmodified lines
66 use byteorder::{BigEndian, ByteOrder};
77 use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE;
88 use std::{
9− convert::{TryFrom, TryInto},
9+ convert::TryInto,
1010 fmt::{Debug, Formatter},
1111 slice::Chunks,
1212 };
@@ -39,7 +39,7 @@ pub struct Commit<'a> { · 26 unmodified lines
3939 generation: u32,
4040 parent1: ParentEdge,
4141 parent2: ParentEdge,
42− root_tree_id: git_hash::borrowed::Id<'a>,
42+ root_tree_id: &'a git_hash::oid,
4343 }
4444
4545 impl<'a> Commit<'a> {
@@ -48,7 +48,7 @@ impl<'a> Commit<'a> { · 2 unmodified lines
4848 Commit {
4949 file,
5050 pos,
51− root_tree_id: git_hash::borrowed::Id::try_from(&bytes[..SHA1_SIZE]).expect("20 bytes SHA1 to be alright"),
51+ root_tree_id: git_hash::oid::try_from(&bytes[..SHA1_SIZE]).expect("20 bytes SHA1 to be alright"),
5252 parent1: ParentEdge::from_raw(BigEndian::read_u32(&bytes[SHA1_SIZE..SHA1_SIZE + 4])),
5353 parent2: ParentEdge::from_raw(BigEndian::read_u32(&bytes[SHA1_SIZE + 4..SHA1_SIZE + 8])),
5454 generation: BigEndian::read_u32(&bytes[SHA1_SIZE + 8..SHA1_SIZE + 12]) >> 2,
@@ -83,7 +83,7 @@ impl<'a> Commit<'a> { · 28 unmodified lines
8383 }
8484
8585 /// Returns the hash of this commit.
86− pub fn id(&self) -> git_hash::borrowed::Id<'a> {
86+ pub fn id(&self) -> &'a git_hash::oid {
8787 self.file.id_at(self.pos)
8888 }
8989
@@ -98,7 +98,7 @@ impl<'a> Commit<'a> { · 8 unmodified lines
9898 }
9999
100100 /// Return the hash of the tree this commit points to.
101− pub fn root_tree_id(&self) -> git_hash::borrowed::Id<'a> {
101+ pub fn root_tree_id(&self) -> &git_hash::oid {
102102 self.root_tree_id
103103 }
104104 }