1
1
use crate :: file:: { self , commit:: Commit , File , COMMIT_DATA_ENTRY_SIZE } ;
2
2
use git_hash:: SIZE_OF_SHA1_DIGEST as SHA1_SIZE ;
3
- use git_object:: { borrowed , HashKind } ;
3
+ use git_object:: HashKind ;
4
4
use std:: {
5
5
convert:: { TryFrom , TryInto } ,
6
6
fmt:: { Debug , Formatter } ,
@@ -35,7 +35,7 @@ impl File {
35
35
/// Returns 20 bytes sha1 at the given index in our list of (sorted) sha1 hashes.
36
36
/// The position ranges from 0 to self.num_commits()
37
37
// copied from git-odb/src/pack/index/access.rs
38
- pub fn id_at ( & self , pos : file:: Position ) -> borrowed:: Id < ' _ > {
38
+ pub fn id_at ( & self , pos : file:: Position ) -> git_hash :: borrowed:: Id < ' _ > {
39
39
assert ! (
40
40
pos. 0 < self . num_commits( ) ,
41
41
"expected lexigraphical position less than {}, got {}" ,
@@ -47,16 +47,16 @@ impl File {
47
47
. try_into ( )
48
48
. expect ( "an architecture able to hold 32 bits of integer" ) ;
49
49
let start = self . oid_lookup_offset + ( pos * SHA1_SIZE ) ;
50
- borrowed:: Id :: try_from ( & self . data [ start..start + SHA1_SIZE ] ) . expect ( "20 bytes SHA1 to be alright" )
50
+ git_hash :: borrowed:: Id :: try_from ( & self . data [ start..start + SHA1_SIZE ] ) . expect ( "20 bytes SHA1 to be alright" )
51
51
}
52
52
53
53
/// Return an iterator over all object hashes stored in the base graph.
54
- pub fn iter_base_graph_ids ( & self ) -> impl Iterator < Item = borrowed:: Id < ' _ > > {
54
+ pub fn iter_base_graph_ids ( & self ) -> impl Iterator < Item = git_hash :: borrowed:: Id < ' _ > > {
55
55
let start = self . base_graphs_list_offset . unwrap_or ( 0 ) ;
56
56
let base_graphs_list = & self . data [ start..start + ( SHA1_SIZE * usize:: from ( self . base_graph_count ) ) ] ;
57
57
base_graphs_list
58
58
. chunks ( SHA1_SIZE )
59
- . map ( |bytes| borrowed:: Id :: try_from ( bytes) . expect ( "20 bytes SHA1 to be alright" ) )
59
+ . map ( |bytes| git_hash :: borrowed:: Id :: try_from ( bytes) . expect ( "20 bytes SHA1 to be alright" ) )
60
60
}
61
61
62
62
/// return an iterator over all commits in this file.
@@ -65,13 +65,13 @@ impl File {
65
65
}
66
66
67
67
/// Return an iterator over all object hashes stored in this file.
68
- pub fn iter_ids ( & self ) -> impl Iterator < Item = borrowed:: Id < ' _ > > {
68
+ pub fn iter_ids ( & self ) -> impl Iterator < Item = git_hash :: borrowed:: Id < ' _ > > {
69
69
( 0 ..self . num_commits ( ) ) . map ( move |i| self . id_at ( file:: Position ( i) ) )
70
70
}
71
71
72
72
/// Translate the given object hash to its position within this file, if present.
73
73
// copied from git-odb/src/pack/index/access.rs
74
- pub fn lookup ( & self , id : borrowed:: Id < ' _ > ) -> Option < file:: Position > {
74
+ pub fn lookup ( & self , id : git_hash :: borrowed:: Id < ' _ > ) -> Option < file:: Position > {
75
75
let first_byte = usize:: from ( id. first_byte ( ) ) ;
76
76
let mut upper_bound = self . fan [ first_byte] ;
77
77
let mut lower_bound = if first_byte != 0 { self . fan [ first_byte - 1 ] } else { 0 } ;
0 commit comments