Showing the changes to git-commitgraph/src/file/commit.rs (1 of 22 files). Show all
Unified · Split
| @@ -5,7 +5,7 @@ use crate::{ · 4 unmodified lines | |||
| 5 | }; | 5 | }; |
| 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 git_object::{borrowed, owned}; | 8 | use git_object::owned; |
| 9 | use std::{ | 9 | use std::{ |
| 10 | convert::{TryFrom, TryInto}, | 10 | convert::{TryFrom, TryInto}, |
| 11 | fmt::{Debug, Formatter}, | 11 | fmt::{Debug, Formatter}, |
| @@ -40,7 +40,7 @@ pub struct Commit<'a> { · 28 unmodified lines | |||
| 40 | generation: u32, | 40 | generation: u32, |
| 41 | parent1: ParentEdge, | 41 | parent1: ParentEdge, |
| 42 | parent2: ParentEdge, | 42 | parent2: ParentEdge, |
| 43 | root_tree_id: borrowed::Id<'a>, | 43 | root_tree_id: git_hash::borrowed::Id<'a>, |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | impl<'a> Commit<'a> { | 46 | impl<'a> Commit<'a> { |
| @@ -49,7 +49,7 @@ impl<'a> Commit<'a> { · 2 unmodified lines | |||
| 49 | Commit { | 49 | Commit { |
| 50 | file, | 50 | file, |
| 51 | pos, | 51 | pos, |
| 52 | root_tree_id: borrowed::Id::try_from(&bytes[..SHA1_SIZE]).expect("20 bytes SHA1 to be alright"), | 52 | root_tree_id: git_hash::borrowed::Id::try_from(&bytes[..SHA1_SIZE]).expect("20 bytes SHA1 to be alright"), |
| 53 | parent1: ParentEdge::from_raw(BigEndian::read_u32(&bytes[SHA1_SIZE..SHA1_SIZE + 4])), | 53 | parent1: ParentEdge::from_raw(BigEndian::read_u32(&bytes[SHA1_SIZE..SHA1_SIZE + 4])), |
| 54 | parent2: ParentEdge::from_raw(BigEndian::read_u32(&bytes[SHA1_SIZE + 4..SHA1_SIZE + 8])), | 54 | parent2: ParentEdge::from_raw(BigEndian::read_u32(&bytes[SHA1_SIZE + 4..SHA1_SIZE + 8])), |
| 55 | generation: BigEndian::read_u32(&bytes[SHA1_SIZE + 8..SHA1_SIZE + 12]) >> 2, | 55 | generation: BigEndian::read_u32(&bytes[SHA1_SIZE + 8..SHA1_SIZE + 12]) >> 2, |
| @@ -84,7 +84,7 @@ impl<'a> Commit<'a> { · 28 unmodified lines | |||
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | /// Returns the hash of this commit. | 86 | /// Returns the hash of this commit. |
| 87 | pub fn id(&self) -> borrowed::Id<'a> { | 87 | pub fn id(&self) -> git_hash::borrowed::Id<'a> { |
| 88 | self.file.id_at(self.pos) | 88 | self.file.id_at(self.pos) |
| 89 | } | 89 | } |
| 90 | 90 | ||
| @@ -99,7 +99,7 @@ impl<'a> Commit<'a> { · 8 unmodified lines | |||
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | /// Return the hash of the tree this commit points to. | 101 | /// Return the hash of the tree this commit points to. |
| 102 | pub fn root_tree_id(&self) -> borrowed::Id<'a> { | 102 | pub fn root_tree_id(&self) -> git_hash::borrowed::Id<'a> { |
| 103 | self.root_tree_id | 103 | self.root_tree_id |
| 104 | } | 104 | } |
| 105 | } | 105 | } |