@@ -3831,12 +3831,10 @@ static int pack_mtime_cmp(const void *_a, const void *_b)
38313831
38323832static void read_packs_list_from_stdin (struct rev_info * revs )
38333833{
3834- struct packfile_store * packs = the_repository -> objects -> packfiles ;
38353834 struct strbuf buf = STRBUF_INIT ;
38363835 struct string_list include_packs = STRING_LIST_INIT_DUP ;
38373836 struct string_list exclude_packs = STRING_LIST_INIT_DUP ;
38383837 struct string_list_item * item = NULL ;
3839-
38403838 struct packed_git * p ;
38413839
38423840 while (strbuf_getline (& buf , stdin ) != EOF ) {
@@ -3856,7 +3854,7 @@ static void read_packs_list_from_stdin(struct rev_info *revs)
38563854 string_list_sort (& exclude_packs );
38573855 string_list_remove_duplicates (& exclude_packs , 0 );
38583856
3859- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next ) {
3857+ repo_for_each_pack ( the_repository , p ) {
38603858 const char * pack_name = pack_basename (p );
38613859
38623860 if ((item = string_list_lookup (& include_packs , pack_name )))
@@ -4077,7 +4075,6 @@ static void enumerate_cruft_objects(void)
40774075
40784076static void enumerate_and_traverse_cruft_objects (struct string_list * fresh_packs )
40794077{
4080- struct packfile_store * packs = the_repository -> objects -> packfiles ;
40814078 struct packed_git * p ;
40824079 struct rev_info revs ;
40834080 int ret ;
@@ -4107,7 +4104,7 @@ static void enumerate_and_traverse_cruft_objects(struct string_list *fresh_packs
41074104 * Re-mark only the fresh packs as kept so that objects in
41084105 * unknown packs do not halt the reachability traversal early.
41094106 */
4110- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next )
4107+ repo_for_each_pack ( the_repository , p )
41114108 p -> pack_keep_in_core = 0 ;
41124109 mark_pack_kept_in_core (fresh_packs , 1 );
41134110
@@ -4124,7 +4121,6 @@ static void enumerate_and_traverse_cruft_objects(struct string_list *fresh_packs
41244121
41254122static void read_cruft_objects (void )
41264123{
4127- struct packfile_store * packs = the_repository -> objects -> packfiles ;
41284124 struct strbuf buf = STRBUF_INIT ;
41294125 struct string_list discard_packs = STRING_LIST_INIT_DUP ;
41304126 struct string_list fresh_packs = STRING_LIST_INIT_DUP ;
@@ -4145,7 +4141,7 @@ static void read_cruft_objects(void)
41454141 string_list_sort (& discard_packs );
41464142 string_list_sort (& fresh_packs );
41474143
4148- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next ) {
4144+ repo_for_each_pack ( the_repository , p ) {
41494145 const char * pack_name = pack_basename (p );
41504146 struct string_list_item * item ;
41514147
@@ -4398,7 +4394,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
43984394 struct packed_git * p ;
43994395
44004396 p = (last_found != (void * )1 ) ? last_found :
4401- packfile_store_get_all_packs (packs );
4397+ packfile_store_get_packs (packs );
44024398
44034399 while (p ) {
44044400 if ((!p -> pack_local || p -> pack_keep ||
@@ -4408,7 +4404,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
44084404 return 1 ;
44094405 }
44104406 if (p == last_found )
4411- p = packfile_store_get_all_packs (packs );
4407+ p = packfile_store_get_packs (packs );
44124408 else
44134409 p = p -> next ;
44144410 if (p == last_found )
@@ -4440,13 +4436,12 @@ static int loosened_object_can_be_discarded(const struct object_id *oid,
44404436
44414437static void loosen_unused_packed_objects (void )
44424438{
4443- struct packfile_store * packs = the_repository -> objects -> packfiles ;
44444439 struct packed_git * p ;
44454440 uint32_t i ;
44464441 uint32_t loosened_objects_nr = 0 ;
44474442 struct object_id oid ;
44484443
4449- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next ) {
4444+ repo_for_each_pack ( the_repository , p ) {
44504445 if (!p -> pack_local || p -> pack_keep || p -> pack_keep_in_core )
44514446 continue ;
44524447
@@ -4747,13 +4742,12 @@ static void get_object_list(struct rev_info *revs, struct strvec *argv)
47474742
47484743static void add_extra_kept_packs (const struct string_list * names )
47494744{
4750- struct packfile_store * packs = the_repository -> objects -> packfiles ;
47514745 struct packed_git * p ;
47524746
47534747 if (!names -> nr )
47544748 return ;
47554749
4756- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next ) {
4750+ repo_for_each_pack ( the_repository , p ) {
47574751 const char * name = basename (p -> pack_name );
47584752 int i ;
47594753
@@ -5191,10 +5185,9 @@ int cmd_pack_objects(int argc,
51915185
51925186 add_extra_kept_packs (& keep_pack_list );
51935187 if (ignore_packed_keep_on_disk ) {
5194- struct packfile_store * packs = the_repository -> objects -> packfiles ;
51955188 struct packed_git * p ;
51965189
5197- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next )
5190+ repo_for_each_pack ( the_repository , p )
51985191 if (p -> pack_local && p -> pack_keep )
51995192 break ;
52005193 if (!p ) /* no keep-able packs found */
@@ -5206,10 +5199,9 @@ int cmd_pack_objects(int argc,
52065199 * want to unset "local" based on looking at packs, as
52075200 * it also covers non-local objects
52085201 */
5209- struct packfile_store * packs = the_repository -> objects -> packfiles ;
52105202 struct packed_git * p ;
52115203
5212- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next ) {
5204+ repo_for_each_pack ( the_repository , p ) {
52135205 if (!p -> pack_local ) {
52145206 have_non_local_packs = 1 ;
52155207 break ;
0 commit comments