@@ -3830,12 +3830,10 @@ static int pack_mtime_cmp(const void *_a, const void *_b)
38303830
38313831static void read_packs_list_from_stdin (struct rev_info * revs )
38323832{
3833- struct packfile_store * packs = the_repository -> objects -> packfiles ;
38343833 struct strbuf buf = STRBUF_INIT ;
38353834 struct string_list include_packs = STRING_LIST_INIT_DUP ;
38363835 struct string_list exclude_packs = STRING_LIST_INIT_DUP ;
38373836 struct string_list_item * item = NULL ;
3838-
38393837 struct packed_git * p ;
38403838
38413839 while (strbuf_getline (& buf , stdin ) != EOF ) {
@@ -3855,7 +3853,7 @@ static void read_packs_list_from_stdin(struct rev_info *revs)
38553853 string_list_sort (& exclude_packs );
38563854 string_list_remove_duplicates (& exclude_packs , 0 );
38573855
3858- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next ) {
3856+ repo_for_each_pack ( the_repository , p ) {
38593857 const char * pack_name = pack_basename (p );
38603858
38613859 if ((item = string_list_lookup (& include_packs , pack_name )))
@@ -4076,7 +4074,6 @@ static void enumerate_cruft_objects(void)
40764074
40774075static void enumerate_and_traverse_cruft_objects (struct string_list * fresh_packs )
40784076{
4079- struct packfile_store * packs = the_repository -> objects -> packfiles ;
40804077 struct packed_git * p ;
40814078 struct rev_info revs ;
40824079 int ret ;
@@ -4106,7 +4103,7 @@ static void enumerate_and_traverse_cruft_objects(struct string_list *fresh_packs
41064103 * Re-mark only the fresh packs as kept so that objects in
41074104 * unknown packs do not halt the reachability traversal early.
41084105 */
4109- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next )
4106+ repo_for_each_pack ( the_repository , p )
41104107 p -> pack_keep_in_core = 0 ;
41114108 mark_pack_kept_in_core (fresh_packs , 1 );
41124109
@@ -4123,7 +4120,6 @@ static void enumerate_and_traverse_cruft_objects(struct string_list *fresh_packs
41234120
41244121static void read_cruft_objects (void )
41254122{
4126- struct packfile_store * packs = the_repository -> objects -> packfiles ;
41274123 struct strbuf buf = STRBUF_INIT ;
41284124 struct string_list discard_packs = STRING_LIST_INIT_DUP ;
41294125 struct string_list fresh_packs = STRING_LIST_INIT_DUP ;
@@ -4144,7 +4140,7 @@ static void read_cruft_objects(void)
41444140 string_list_sort (& discard_packs );
41454141 string_list_sort (& fresh_packs );
41464142
4147- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next ) {
4143+ repo_for_each_pack ( the_repository , p ) {
41484144 const char * pack_name = pack_basename (p );
41494145 struct string_list_item * item ;
41504146
@@ -4397,7 +4393,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
43974393 struct packed_git * p ;
43984394
43994395 p = (last_found != (void * )1 ) ? last_found :
4400- packfile_store_get_all_packs (packs );
4396+ packfile_store_get_packs (packs );
44014397
44024398 while (p ) {
44034399 if ((!p -> pack_local || p -> pack_keep ||
@@ -4407,7 +4403,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
44074403 return 1 ;
44084404 }
44094405 if (p == last_found )
4410- p = packfile_store_get_all_packs (packs );
4406+ p = packfile_store_get_packs (packs );
44114407 else
44124408 p = p -> next ;
44134409 if (p == last_found )
@@ -4439,13 +4435,12 @@ static int loosened_object_can_be_discarded(const struct object_id *oid,
44394435
44404436static void loosen_unused_packed_objects (void )
44414437{
4442- struct packfile_store * packs = the_repository -> objects -> packfiles ;
44434438 struct packed_git * p ;
44444439 uint32_t i ;
44454440 uint32_t loosened_objects_nr = 0 ;
44464441 struct object_id oid ;
44474442
4448- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next ) {
4443+ repo_for_each_pack ( the_repository , p ) {
44494444 if (!p -> pack_local || p -> pack_keep || p -> pack_keep_in_core )
44504445 continue ;
44514446
@@ -4743,13 +4738,12 @@ static void get_object_list(struct rev_info *revs, struct strvec *argv)
47434738
47444739static void add_extra_kept_packs (const struct string_list * names )
47454740{
4746- struct packfile_store * packs = the_repository -> objects -> packfiles ;
47474741 struct packed_git * p ;
47484742
47494743 if (!names -> nr )
47504744 return ;
47514745
4752- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next ) {
4746+ repo_for_each_pack ( the_repository , p ) {
47534747 const char * name = basename (p -> pack_name );
47544748 int i ;
47554749
@@ -5187,10 +5181,9 @@ int cmd_pack_objects(int argc,
51875181
51885182 add_extra_kept_packs (& keep_pack_list );
51895183 if (ignore_packed_keep_on_disk ) {
5190- struct packfile_store * packs = the_repository -> objects -> packfiles ;
51915184 struct packed_git * p ;
51925185
5193- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next )
5186+ repo_for_each_pack ( the_repository , p )
51945187 if (p -> pack_local && p -> pack_keep )
51955188 break ;
51965189 if (!p ) /* no keep-able packs found */
@@ -5202,10 +5195,9 @@ int cmd_pack_objects(int argc,
52025195 * want to unset "local" based on looking at packs, as
52035196 * it also covers non-local objects
52045197 */
5205- struct packfile_store * packs = the_repository -> objects -> packfiles ;
52065198 struct packed_git * p ;
52075199
5208- for ( p = packfile_store_get_all_packs ( packs ); p ; p = p -> next ) {
5200+ repo_for_each_pack ( the_repository , p ) {
52095201 if (!p -> pack_local ) {
52105202 have_non_local_packs = 1 ;
52115203 break ;
0 commit comments