File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
gix-odb/src/store_impls/dynamic Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -99,17 +99,24 @@ impl Store {
99
99
let mut db_paths = crate :: alternate:: resolve ( objects_dir. clone ( ) , & current_dir)
100
100
. map_err ( |err| std:: io:: Error :: new ( std:: io:: ErrorKind :: Other , err) ) ?;
101
101
db_paths. insert ( 0 , objects_dir. clone ( ) ) ;
102
- let num_slots = super :: Store :: collect_indices_and_mtime_sorted_by_size ( db_paths, None , None )
102
+ let num_slots = Store :: collect_indices_and_mtime_sorted_by_size ( db_paths, None , None )
103
103
. map_err ( |err| std:: io:: Error :: new ( std:: io:: ErrorKind :: Other , err) ) ?
104
104
. len ( ) ;
105
105
106
- ( ( num_slots as f32 * multiplier) as usize ) . max ( minimum)
106
+ let candidate = ( ( num_slots as f32 * multiplier) as usize ) . max ( minimum) ;
107
+ if candidate > crate :: store:: types:: PackId :: max_indices ( ) {
108
+ // A chance for this to work without 10% extra allocation - this already
109
+ // is an insane amount of packs.
110
+ num_slots
111
+ } else {
112
+ candidate
113
+ }
107
114
}
108
115
} ;
109
116
if slot_count > crate :: store:: types:: PackId :: max_indices ( ) {
110
117
return Err ( std:: io:: Error :: new (
111
118
std:: io:: ErrorKind :: Other ,
112
- "Cannot use more than 1 ^15 slots" ,
119
+ format ! ( "Cannot use more than 2 ^15-1 slots, got {slot_count}" ) ,
113
120
) ) ;
114
121
}
115
122
let mut replacements: Vec < _ > = replacements. collect ( ) ;
You can’t perform that action at this time.
0 commit comments