@@ -6,13 +6,13 @@ use std::{
6
6
7
7
use bstr:: BStr ;
8
8
use gix_filter:: { driver:: apply:: MaybeDelayed , pipeline:: convert:: ToWorktreeOutcome } ;
9
- use gix_hash:: oid;
10
9
use gix_index:: { entry:: Stat , Entry } ;
10
+ use gix_object:: FindExt ;
11
11
use gix_worktree:: Stack ;
12
12
use io_close:: Close ;
13
13
14
14
pub struct Context < ' a , Find > {
15
- pub find : & ' a mut Find ,
15
+ pub objects : & ' a mut Find ,
16
16
pub path_cache : & ' a mut Stack ,
17
17
pub filters : & ' a mut gix_filter:: Pipeline ,
18
18
pub buf : & ' a mut Vec < u8 > ,
@@ -53,11 +53,11 @@ impl Outcome<'_> {
53
53
}
54
54
55
55
#[ cfg_attr( not( unix) , allow( unused_variables) ) ]
56
- pub fn checkout < ' entry , Find , E > (
56
+ pub fn checkout < ' entry , Find > (
57
57
entry : & ' entry mut Entry ,
58
58
entry_path : & ' entry BStr ,
59
59
Context {
60
- find ,
60
+ objects ,
61
61
filters,
62
62
path_cache,
63
63
buf,
@@ -73,25 +73,25 @@ pub fn checkout<'entry, Find, E>(
73
73
filter_process_delay,
74
74
..
75
75
} : crate :: checkout:: chunk:: Options ,
76
- ) -> Result < Outcome < ' entry > , crate :: checkout:: Error < E > >
76
+ ) -> Result < Outcome < ' entry > , crate :: checkout:: Error >
77
77
where
78
- Find : for < ' a > FnMut ( & oid , & ' a mut Vec < u8 > ) -> Result < gix_object:: BlobRef < ' a > , E > ,
79
- E : std:: error:: Error + Send + Sync + ' static ,
78
+ Find : gix_object:: Find ,
80
79
{
81
80
let dest_relative = gix_path:: try_from_bstr ( entry_path) . map_err ( |_| crate :: checkout:: Error :: IllformedUtf8 {
82
81
path : entry_path. to_owned ( ) ,
83
82
} ) ?;
84
83
let is_dir = Some ( entry. mode == gix_index:: entry:: Mode :: COMMIT || entry. mode == gix_index:: entry:: Mode :: DIR ) ;
85
- let path_cache = path_cache. at_path ( dest_relative, is_dir, & mut * find ) ?;
84
+ let path_cache = path_cache. at_path ( dest_relative, is_dir, & * objects ) ?;
86
85
let dest = path_cache. path ( ) ;
87
86
88
87
let object_size = match entry. mode {
89
88
gix_index:: entry:: Mode :: FILE | gix_index:: entry:: Mode :: FILE_EXECUTABLE => {
90
- let obj = find ( & entry. id , buf) . map_err ( |err| crate :: checkout:: Error :: Find {
91
- err,
92
- oid : entry. id ,
93
- path : dest. to_path_buf ( ) ,
94
- } ) ?;
89
+ let obj = ( & * objects)
90
+ . find_blob ( & entry. id , buf)
91
+ . map_err ( |err| crate :: checkout:: Error :: Find {
92
+ err,
93
+ path : dest. to_path_buf ( ) ,
94
+ } ) ?;
95
95
96
96
let filtered = filters. convert_to_worktree (
97
97
obj. data ,
@@ -140,11 +140,12 @@ where
140
140
num_bytes
141
141
}
142
142
gix_index:: entry:: Mode :: SYMLINK => {
143
- let obj = find ( & entry. id , buf) . map_err ( |err| crate :: checkout:: Error :: Find {
144
- err,
145
- oid : entry. id ,
146
- path : dest. to_path_buf ( ) ,
147
- } ) ?;
143
+ let obj = ( & * objects)
144
+ . find_blob ( & entry. id , buf)
145
+ . map_err ( |err| crate :: checkout:: Error :: Find {
146
+ err,
147
+ path : dest. to_path_buf ( ) ,
148
+ } ) ?;
148
149
let symlink_destination = gix_path:: try_from_byte_slice ( obj. data )
149
150
. map_err ( |_| crate :: checkout:: Error :: IllformedUtf8 { path : obj. data . into ( ) } ) ?;
150
151
@@ -269,14 +270,11 @@ pub(crate) fn open_file(
269
270
270
271
/// Close `file` and store its stats in `entry`, possibly setting `file` executable depending on `set_executable_after_creation`.
271
272
#[ cfg_attr( windows, allow( unused_variables) ) ]
272
- pub ( crate ) fn finalize_entry < E > (
273
+ pub ( crate ) fn finalize_entry (
273
274
entry : & mut gix_index:: Entry ,
274
275
file : std:: fs:: File ,
275
276
set_executable_after_creation : Option < & Path > ,
276
- ) -> Result < ( ) , crate :: checkout:: Error < E > >
277
- where
278
- E : std:: error:: Error + Send + Sync + ' static ,
279
- {
277
+ ) -> Result < ( ) , crate :: checkout:: Error > {
280
278
// For possibly existing, overwritten files, we must change the file mode explicitly.
281
279
#[ cfg( unix) ]
282
280
if let Some ( path) = set_executable_after_creation {
0 commit comments