@@ -585,23 +585,22 @@ static void report_pack_garbage(struct string_list *list)
585585}
586586
587587struct prepare_pack_data {
588- struct odb_source * source ;
588+ struct odb_source_packed * source ;
589589 struct string_list * garbage ;
590590};
591591
592592static void prepare_pack (const char * full_name , size_t full_name_len ,
593593 const char * file_name , void * _data )
594594{
595595 struct prepare_pack_data * data = (struct prepare_pack_data * )_data ;
596- struct odb_source_files * files = odb_source_files_downcast (data -> source );
597596 size_t base_len = full_name_len ;
598597
599598 if (strip_suffix_mem (full_name , & base_len , ".idx" ) &&
600- !(files -> packed -> midx &&
601- midx_contains_pack (files -> packed -> midx , file_name ))) {
599+ !(data -> source -> midx &&
600+ midx_contains_pack (data -> source -> midx , file_name ))) {
602601 char * trimmed_path = xstrndup (full_name , full_name_len );
603- packfile_store_load_pack (files -> packed ,
604- trimmed_path , data -> source -> local );
602+ packfile_store_load_pack (data -> source ,
603+ trimmed_path , data -> source -> base . local );
605604 free (trimmed_path );
606605 }
607606
@@ -626,15 +625,15 @@ static void prepare_pack(const char *full_name, size_t full_name_len,
626625 report_garbage (PACKDIR_FILE_GARBAGE , full_name );
627626}
628627
629- static void prepare_packed_git_one (struct odb_source * source )
628+ static void prepare_packed_git_one (struct odb_source_packed * source )
630629{
631630 struct string_list garbage = STRING_LIST_INIT_DUP ;
632631 struct prepare_pack_data data = {
633632 .source = source ,
634633 .garbage = & garbage ,
635634 };
636635
637- for_each_file_in_pack_dir (source -> path , prepare_pack , & data );
636+ for_each_file_in_pack_dir (source -> base . path , prepare_pack , & data );
638637
639638 report_pack_garbage (data .garbage );
640639 string_list_clear (data .garbage , 0 );
@@ -675,7 +674,7 @@ void odb_source_packed_prepare(struct odb_source_packed *source)
675674 return ;
676675
677676 prepare_multi_pack_index_one (source );
678- prepare_packed_git_one (& source -> files -> base );
677+ prepare_packed_git_one (source );
679678
680679 sort_packs (& source -> packs .head , sort_pack );
681680 for (struct packfile_list_entry * e = source -> packs .head ; e ; e = e -> next )
@@ -733,14 +732,14 @@ static void odb_source_packed_free(struct odb_source *source)
733732 free (packed );
734733}
735734
736- struct odb_source_packed * odb_source_packed_new (struct odb_source_files * parent )
735+ struct odb_source_packed * odb_source_packed_new (struct object_database * odb ,
736+ const char * path ,
737+ bool local )
737738{
738739 struct odb_source_packed * packed ;
739740
740741 CALLOC_ARRAY (packed , 1 );
741- odb_source_init (& packed -> base , parent -> base .odb , ODB_SOURCE_PACKED ,
742- parent -> base .path , parent -> base .local );
743- packed -> files = parent ;
742+ odb_source_init (& packed -> base , odb , ODB_SOURCE_PACKED , path , local );
744743 strmap_init (& packed -> packs_by_path );
745744
746745 packed -> base .free = odb_source_packed_free ;
@@ -758,7 +757,7 @@ struct odb_source_packed *odb_source_packed_new(struct odb_source_files *parent)
758757 packed -> base .read_alternates = odb_source_packed_read_alternates ;
759758 packed -> base .write_alternate = odb_source_packed_write_alternate ;
760759
761- if (!is_absolute_path (parent -> base . path ))
760+ if (!is_absolute_path (path ))
762761 chdir_notify_register (NULL , odb_source_packed_reparent , packed );
763762
764763 return packed ;
0 commit comments