@@ -31,7 +31,9 @@ pub struct Entry {
31
31
/// amount of bytes used to encode the `header`. `pack_offset + header_size` is the beginning of the compressed data in the pack.
32
32
pub header_size : u16 ,
33
33
pub pack_offset : u64 ,
34
- /// amount bytes consumed while producing `decompressed`
34
+ /// The bytes consumed while producing `decompressed`
35
+ /// These do not contain the header, which makes it possible to easily replace a RefDelta with offset deltas
36
+ /// when resolving thin packs.
35
37
pub compressed : Vec < u8 > ,
36
38
/// The decompressed data.
37
39
pub decompressed : Vec < u8 > ,
@@ -136,10 +138,7 @@ where
136
138
let mut decompressor = self . decompressor . take ( ) . unwrap_or_default ( ) ;
137
139
decompressor. reset ( ) ;
138
140
let mut reader = InflateReaderBoxed {
139
- inner : read_and_pass_to (
140
- & mut self . read ,
141
- Vec :: with_capacity ( ( entry. decompressed_size / 2 ) as usize ) ,
142
- ) ,
141
+ inner : read_and_pass_to ( & mut self . read , Vec :: with_capacity ( ( entry. decompressed_size ) as usize ) ) ,
143
142
decompressor,
144
143
} ;
145
144
@@ -156,8 +155,7 @@ where
156
155
self . offset += entry. header_size ( ) as u64 + compressed_size;
157
156
self . decompressor = Some ( reader. decompressor ) ;
158
157
159
- let mut compressed = reader. inner . write ;
160
- compressed. shrink_to_fit ( ) ;
158
+ let compressed = reader. inner . write ;
161
159
debug_assert_eq ! (
162
160
compressed_size,
163
161
compressed. len( ) as u64 ,
@@ -209,7 +207,7 @@ where
209
207
}
210
208
211
209
fn read_and_pass_to < R : io:: Read , W : io:: Write > ( read : & mut R , to : W ) -> PassThrough < & mut R , W > {
212
- PassThrough { read : read , write : to }
210
+ PassThrough { read, write : to }
213
211
}
214
212
215
213
impl < R > Iterator for Iter < R >
0 commit comments