treewide: use get_all_packs

There are many places in the codebase that want to iterate over
all packfiles known to Git. The purposes are wide-ranging, and
those that can take advantage of the multi-pack-index already
do. So, use get_all_packs() instead of get_packed_git() to be
sure we are iterating over all packfiles.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Derrick Stolee
2018-08-20 16:52:04 +00:00
committed by Junio C Hamano
parent 0bff5269d3
commit 454ea2e4d7
11 changed files with 23 additions and 23 deletions

View File

@ -2809,7 +2809,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
memset(&in_pack, 0, sizeof(in_pack));
for (p = get_packed_git(the_repository); p; p = p->next) {
for (p = get_all_packs(the_repository); p; p = p->next) {
struct object_id oid;
struct object *o;
@ -2873,7 +2873,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
struct packed_git *p;
p = (last_found != (void *)1) ? last_found :
get_packed_git(the_repository);
get_all_packs(the_repository);
while (p) {
if ((!p->pack_local || p->pack_keep ||
@ -2883,7 +2883,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
return 1;
}
if (p == last_found)
p = get_packed_git(the_repository);
p = get_all_packs(the_repository);
else
p = p->next;
if (p == last_found)
@ -2919,7 +2919,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
uint32_t i;
struct object_id oid;
for (p = get_packed_git(the_repository); p; p = p->next) {
for (p = get_all_packs(the_repository); p; p = p->next) {
if (!p->pack_local || p->pack_keep || p->pack_keep_in_core)
continue;
@ -3066,7 +3066,7 @@ static void add_extra_kept_packs(const struct string_list *names)
if (!names->nr)
return;
for (p = get_packed_git(the_repository); p; p = p->next) {
for (p = get_all_packs(the_repository); p; p = p->next) {
const char *name = basename(p->pack_name);
int i;
@ -3339,7 +3339,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
add_extra_kept_packs(&keep_pack_list);
if (ignore_packed_keep_on_disk) {
struct packed_git *p;
for (p = get_packed_git(the_repository); p; p = p->next)
for (p = get_all_packs(the_repository); p; p = p->next)
if (p->pack_local && p->pack_keep)
break;
if (!p) /* no keep-able packs found */
@ -3352,7 +3352,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
* it also covers non-local objects
*/
struct packed_git *p;
for (p = get_packed_git(the_repository); p; p = p->next) {
for (p = get_all_packs(the_repository); p; p = p->next) {
if (!p->pack_local) {
have_non_local_packs = 1;
break;