@@ -310,21 +310,23 @@ impl Chunking {
310310 return Ok ( ( ) ) ;
311311 }
312312
313- // Reverses `contentmeta.map` i.e. contentid -> Vec<checksum>
314- let mut rmap = IndexMap :: < ContentID , Vec < & String > > :: new ( ) ;
315- for ( checksum, contentid) in meta. map . iter ( ) {
316- rmap. entry ( Rc :: clone ( contentid) ) . or_default ( ) . push ( checksum) ;
317- }
318-
319313 // Create exclusive chunks first if specified
320314 let mut processed_specific_components = BTreeSet :: new ( ) ;
321315 if let Some ( specific_meta) = specific_contentmeta {
316+ let mut specific_map = IndexMap :: < ContentID , Vec < & String > > :: new ( ) ;
317+ for ( checksum, contentid) in specific_meta. map . iter ( ) {
318+ specific_map
319+ . entry ( Rc :: clone ( contentid) )
320+ . or_default ( )
321+ . push ( checksum) ;
322+ }
323+
322324 for component in & specific_meta. sizes {
323325 let mut chunk = Chunk :: new ( & component. meta . name ) ;
324326 chunk. packages = vec ! [ component. meta. name. to_string( ) ] ;
325327
326328 // Move all objects belonging to this exclusive component
327- if let Some ( objects) = rmap . get ( & component. meta . identifier ) {
329+ if let Some ( objects) = specific_map . get ( & component. meta . identifier ) {
328330 for & obj in objects {
329331 self . remainder . move_obj ( & mut chunk, obj) ;
330332 }
@@ -353,6 +355,12 @@ impl Chunking {
353355 . cloned ( )
354356 . collect ( ) ;
355357
358+ // Reverses `contentmeta.map` i.e. contentid -> Vec<checksum>
359+ let mut rmap = IndexMap :: < ContentID , Vec < & String > > :: new ( ) ;
360+ for ( checksum, contentid) in meta. map . iter ( ) {
361+ rmap. entry ( Rc :: clone ( contentid) ) . or_default ( ) . push ( checksum) ;
362+ }
363+
356364 // Process regular components with bin packing if we have remaining layers
357365 if let Some ( remaining) = NonZeroU32 :: new ( self . remaining ( ) ) {
358366 let start = Instant :: now ( ) ;
0 commit comments