@@ -28,17 +28,19 @@ const unsigned char *get_midx_checksum(struct multi_pack_index *m)
2828 return m -> data + m -> data_len - m -> repo -> hash_algo -> rawsz ;
2929}
3030
31- void get_midx_filename (struct strbuf * out , const char * object_dir )
31+ void get_midx_filename (const struct git_hash_algo * hash_algo ,
32+ struct strbuf * out , const char * object_dir )
3233{
33- get_midx_filename_ext (out , object_dir , NULL , NULL );
34+ get_midx_filename_ext (hash_algo , out , object_dir , NULL , NULL );
3435}
3536
36- void get_midx_filename_ext (struct strbuf * out , const char * object_dir ,
37+ void get_midx_filename_ext (const struct git_hash_algo * hash_algo ,
38+ struct strbuf * out , const char * object_dir ,
3739 const unsigned char * hash , const char * ext )
3840{
3941 strbuf_addf (out , "%s/pack/multi-pack-index" , object_dir );
4042 if (ext )
41- strbuf_addf (out , "-%s.%s" , hash_to_hex (hash ), ext );
43+ strbuf_addf (out , "-%s.%s" , hash_to_hex_algop (hash , hash_algo ), ext );
4244}
4345
4446static int midx_read_oid_fanout (const unsigned char * chunk_start ,
@@ -234,11 +236,13 @@ void get_midx_chain_filename(struct strbuf *buf, const char *object_dir)
234236 strbuf_addstr (buf , "/multi-pack-index-chain" );
235237}
236238
237- void get_split_midx_filename_ext (struct strbuf * buf , const char * object_dir ,
239+ void get_split_midx_filename_ext (const struct git_hash_algo * hash_algo ,
240+ struct strbuf * buf , const char * object_dir ,
238241 const unsigned char * hash , const char * ext )
239242{
240243 get_midx_chain_dirname (buf , object_dir );
241- strbuf_addf (buf , "/multi-pack-index-%s.%s" , hash_to_hex (hash ), ext );
244+ strbuf_addf (buf , "/multi-pack-index-%s.%s" ,
245+ hash_to_hex_algop (hash , hash_algo ), ext );
242246}
243247
244248static int open_multi_pack_index_chain (const struct git_hash_algo * hash_algo ,
@@ -326,8 +330,8 @@ static struct multi_pack_index *load_midx_chain_fd_st(struct repository *r,
326330 valid = 0 ;
327331
328332 strbuf_reset (& buf );
329- get_split_midx_filename_ext (& buf , object_dir , layer . hash ,
330- MIDX_EXT_MIDX );
333+ get_split_midx_filename_ext (r -> hash_algo , & buf , object_dir ,
334+ layer . hash , MIDX_EXT_MIDX );
331335 m = load_multi_pack_index_one (r , object_dir , buf .buf , local );
332336
333337 if (m ) {
@@ -379,7 +383,7 @@ struct multi_pack_index *load_multi_pack_index(struct repository *r,
379383 struct strbuf midx_name = STRBUF_INIT ;
380384 struct multi_pack_index * m ;
381385
382- get_midx_filename (& midx_name , object_dir );
386+ get_midx_filename (r -> hash_algo , & midx_name , object_dir );
383387
384388 m = load_multi_pack_index_one (r , object_dir ,
385389 midx_name .buf , local );
@@ -822,7 +826,7 @@ void clear_midx_file(struct repository *r)
822826{
823827 struct strbuf midx = STRBUF_INIT ;
824828
825- get_midx_filename (& midx , r -> objects -> odb -> path );
829+ get_midx_filename (r -> hash_algo , & midx , r -> objects -> odb -> path );
826830
827831 if (r -> objects && r -> objects -> multi_pack_index ) {
828832 close_midx (r -> objects -> multi_pack_index );
@@ -891,7 +895,7 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
891895 struct stat sb ;
892896 struct strbuf filename = STRBUF_INIT ;
893897
894- get_midx_filename (& filename , object_dir );
898+ get_midx_filename (r -> hash_algo , & filename , object_dir );
895899
896900 if (!stat (filename .buf , & sb )) {
897901 error (_ ("multi-pack-index file exists, but failed to parse" ));
0 commit comments