@@ -97,19 +97,22 @@ enum OutputWriter {
97
97
}
98
98
99
99
impl gix:: odb:: Write for OutputWriter {
100
- type Error = Error ;
101
-
102
- fn write_buf ( & self , kind : object:: Kind , from : & [ u8 ] ) -> Result < ObjectId , Self :: Error > {
100
+ fn write_buf ( & self , kind : object:: Kind , from : & [ u8 ] ) -> Result < ObjectId , gix:: odb:: write:: Error > {
103
101
match self {
104
- OutputWriter :: Loose ( db) => db. write_buf ( kind, from) . map_err ( Into :: into ) ,
105
- OutputWriter :: Sink ( db) => db. write_buf ( kind, from) . map_err ( Into :: into ) ,
102
+ OutputWriter :: Loose ( db) => db. write_buf ( kind, from) ,
103
+ OutputWriter :: Sink ( db) => db. write_buf ( kind, from) ,
106
104
}
107
105
}
108
106
109
- fn write_stream ( & self , kind : object:: Kind , size : u64 , from : impl Read ) -> Result < ObjectId , Self :: Error > {
107
+ fn write_stream (
108
+ & self ,
109
+ kind : object:: Kind ,
110
+ size : u64 ,
111
+ from : & mut dyn Read ,
112
+ ) -> Result < ObjectId , gix:: odb:: write:: Error > {
110
113
match self {
111
- OutputWriter :: Loose ( db) => db. write_stream ( kind, size, from) . map_err ( Into :: into ) ,
112
- OutputWriter :: Sink ( db) => db. write_stream ( kind, size, from) . map_err ( Into :: into ) ,
114
+ OutputWriter :: Loose ( db) => db. write_stream ( kind, size, from) ,
115
+ OutputWriter :: Sink ( db) => db. write_stream ( kind, size, from) ,
113
116
}
114
117
}
115
118
}
@@ -137,7 +140,7 @@ pub fn pack_or_pack_index(
137
140
pack_path : impl AsRef < Path > ,
138
141
object_path : Option < impl AsRef < Path > > ,
139
142
check : SafetyCheck ,
140
- progress : impl NestedProgress ,
143
+ mut progress : impl NestedProgress + ' static ,
141
144
Context {
142
145
thread_limit,
143
146
delete_pack,
@@ -178,11 +181,11 @@ pub fn pack_or_pack_index(
178
181
|_| pack:: index:: traverse:: Algorithm :: Lookup ,
179
182
) ;
180
183
181
- let pack:: index:: traverse:: Outcome { progress , .. } = bundle
184
+ let pack:: index:: traverse:: Outcome { .. } = bundle
182
185
. index
183
186
. traverse (
184
187
& bundle. pack ,
185
- progress,
188
+ & mut progress,
186
189
& should_interrupt,
187
190
{
188
191
let object_path = object_path. map ( |p| p. as_ref ( ) . to_owned ( ) ) ;
@@ -193,7 +196,7 @@ pub fn pack_or_pack_index(
193
196
let mut read_buf = Vec :: new ( ) ;
194
197
move |object_kind, buf, index_entry, progress| {
195
198
let written_id = out. write_buf ( object_kind, buf) . map_err ( |err| Error :: Write {
196
- source : Box :: new ( err) as Box < dyn std :: error :: Error + Send + Sync > ,
199
+ source : err,
197
200
kind : object_kind,
198
201
id : index_entry. oid ,
199
202
} ) ?;
@@ -213,13 +216,13 @@ pub fn pack_or_pack_index(
213
216
}
214
217
if let Some ( verifier) = loose_odb. as_ref ( ) {
215
218
let obj = verifier
216
- . try_find ( written_id, & mut read_buf)
219
+ . try_find ( & written_id, & mut read_buf)
217
220
. map_err ( |err| Error :: WrittenFileCorrupt {
218
221
source : err,
219
222
id : written_id,
220
223
} ) ?
221
224
. ok_or ( Error :: WrittenFileMissing { id : written_id } ) ?;
222
- obj. verify_checksum ( written_id) ?;
225
+ obj. verify_checksum ( & written_id) ?;
223
226
}
224
227
Ok ( ( ) )
225
228
}
0 commit comments