Showing the changes to git-commitgraph/src/file/commit.rs (1 of 6 files). Show all
Unified · Split
| @@ -6,7 +6,7 @@ use crate::{ · 5 unmodified lines | |||
| 6 | use byteorder::{BigEndian, ByteOrder}; | 6 | use byteorder::{BigEndian, ByteOrder}; |
| 7 | use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE; | 7 | use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE; |
| 8 | use std::{ | 8 | use std::{ |
| 9 | convert::{TryFrom, TryInto}, | 9 | convert::TryInto, |
| 10 | fmt::{Debug, Formatter}, | 10 | fmt::{Debug, Formatter}, |
| 11 | slice::Chunks, | 11 | slice::Chunks, |
| 12 | }; | 12 | }; |
| @@ -39,7 +39,7 @@ pub struct Commit<'a> { · 26 unmodified lines | |||
| 39 | generation: u32, | 39 | generation: u32, |
| 40 | parent1: ParentEdge, | 40 | parent1: ParentEdge, |
| 41 | parent2: ParentEdge, | 41 | parent2: ParentEdge, |
| 42 | root_tree_id: git_hash::borrowed::Id<'a>, | 42 | root_tree_id: &'a git_hash::oid, |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | impl<'a> Commit<'a> { | 45 | impl<'a> Commit<'a> { |
| @@ -48,7 +48,7 @@ impl<'a> Commit<'a> { · 2 unmodified lines | |||
| 48 | Commit { | 48 | Commit { |
| 49 | file, | 49 | file, |
| 50 | pos, | 50 | 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"), |
| 52 | parent1: ParentEdge::from_raw(BigEndian::read_u32(&bytes[SHA1_SIZE..SHA1_SIZE + 4])), | 52 | parent1: ParentEdge::from_raw(BigEndian::read_u32(&bytes[SHA1_SIZE..SHA1_SIZE + 4])), |
| 53 | parent2: ParentEdge::from_raw(BigEndian::read_u32(&bytes[SHA1_SIZE + 4..SHA1_SIZE + 8])), | 53 | parent2: ParentEdge::from_raw(BigEndian::read_u32(&bytes[SHA1_SIZE + 4..SHA1_SIZE + 8])), |
| 54 | generation: BigEndian::read_u32(&bytes[SHA1_SIZE + 8..SHA1_SIZE + 12]) >> 2, | 54 | generation: BigEndian::read_u32(&bytes[SHA1_SIZE + 8..SHA1_SIZE + 12]) >> 2, |
| @@ -83,7 +83,7 @@ impl<'a> Commit<'a> { · 28 unmodified lines | |||
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | /// Returns the hash of this commit. | 85 | /// 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 { |
| 87 | self.file.id_at(self.pos) | 87 | self.file.id_at(self.pos) |
| 88 | } | 88 | } |
| 89 | 89 | ||
| @@ -98,7 +98,7 @@ impl<'a> Commit<'a> { · 8 unmodified lines | |||
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | /// Return the hash of the tree this commit points to. | 100 | /// 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 { |
| 102 | self.root_tree_id | 102 | self.root_tree_id |
| 103 | } | 103 | } |
| 104 | } | 104 | } |