MCPcopy Create free account
hub / github.com/git/git / loosen_unused_packed_objects

Function loosen_unused_packed_objects

builtin/pack-objects.c:4617–4646  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4615}
4616
4617static void loosen_unused_packed_objects(void)
4618{
4619 struct packed_git *p;
4620 uint32_t i;
4621 uint32_t loosened_objects_nr = 0;
4622 struct object_id oid;
4623
4624 repo_for_each_pack(the_repository, p) {
4625 if (!p->pack_local || p->pack_keep || p->pack_keep_in_core)
4626 continue;
4627
4628 if (open_pack_index(p))
4629 die(_("cannot open pack index"));
4630
4631 for (i = 0; i < p->num_objects; i++) {
4632 nth_packed_object_id(&oid, p, i);
4633 if (!packlist_find(&to_pack, &oid) &&
4634 !has_sha1_pack_kept_or_nonlocal(&oid) &&
4635 !loosened_object_can_be_discarded(&oid, p->mtime)) {
4636 if (force_object_loose(the_repository->objects->sources,
4637 &oid, p->mtime))
4638 die(_("unable to force loose object"));
4639 loosened_objects_nr++;
4640 }
4641 }
4642 }
4643
4644 trace2_data_intmax("pack-objects", the_repository,
4645 "loosen_unused_packed_objects/loosened", loosened_objects_nr);
4646}
4647
4648/*
4649 * This tracks any options which pack-reuse code expects to be on, or which a

Callers 1

get_object_listFunction · 0.85

Calls 7

open_pack_indexFunction · 0.85
nth_packed_object_idFunction · 0.85
packlist_findFunction · 0.85
force_object_looseFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected