@@ -1529,49 +1529,53 @@ static int want_cruft_object_mtime(struct repository *r,
15291529 const struct object_id * oid ,
15301530 unsigned flags , uint32_t mtime )
15311531{
1532- struct packed_git * * cache ;
1532+ struct odb_source * source ;
15331533
1534- for (cache = kept_pack_cache (r , flags ); * cache ; cache ++ ) {
1535- struct packed_git * p = * cache ;
1536- off_t ofs ;
1537- uint32_t candidate_mtime ;
1534+ for (source = r -> objects -> sources ; source ; source = source -> next ) {
1535+ struct packed_git * * cache = packfile_store_get_kept_pack_cache (source -> packfiles , flags );
15381536
1539- ofs = find_pack_entry_one (oid , p );
1540- if (!ofs )
1541- continue ;
1537+ for (; * cache ; cache ++ ) {
1538+ struct packed_git * p = * cache ;
1539+ off_t ofs ;
1540+ uint32_t candidate_mtime ;
15421541
1543- /*
1544- * We have a copy of the object 'oid' in a non-cruft
1545- * pack. We can avoid packing an additional copy
1546- * regardless of what the existing copy's mtime is since
1547- * it is outside of a cruft pack.
1548- */
1549- if (!p -> is_cruft )
1550- return 0 ;
1551-
1552- /*
1553- * If we have a copy of the object 'oid' in a cruft
1554- * pack, then either read the cruft pack's mtime for
1555- * that object, or, if that can't be loaded, assume the
1556- * pack's mtime itself.
1557- */
1558- if (!load_pack_mtimes (p )) {
1559- uint32_t pos ;
1560- if (offset_to_pack_pos (p , ofs , & pos ) < 0 )
1542+ ofs = find_pack_entry_one (oid , p );
1543+ if (!ofs )
15611544 continue ;
1562- candidate_mtime = nth_packed_mtime (p , pos );
1563- } else {
1564- candidate_mtime = p -> mtime ;
1565- }
15661545
1567- /*
1568- * We have a surviving copy of the object in a cruft
1569- * pack whose mtime is greater than or equal to the one
1570- * we are considering. We can thus avoid packing an
1571- * additional copy of that object.
1572- */
1573- if (mtime <= candidate_mtime )
1574- return 0 ;
1546+ /*
1547+ * We have a copy of the object 'oid' in a non-cruft
1548+ * pack. We can avoid packing an additional copy
1549+ * regardless of what the existing copy's mtime is since
1550+ * it is outside of a cruft pack.
1551+ */
1552+ if (!p -> is_cruft )
1553+ return 0 ;
1554+
1555+ /*
1556+ * If we have a copy of the object 'oid' in a cruft
1557+ * pack, then either read the cruft pack's mtime for
1558+ * that object, or, if that can't be loaded, assume the
1559+ * pack's mtime itself.
1560+ */
1561+ if (!load_pack_mtimes (p )) {
1562+ uint32_t pos ;
1563+ if (offset_to_pack_pos (p , ofs , & pos ) < 0 )
1564+ continue ;
1565+ candidate_mtime = nth_packed_mtime (p , pos );
1566+ } else {
1567+ candidate_mtime = p -> mtime ;
1568+ }
1569+
1570+ /*
1571+ * We have a surviving copy of the object in a cruft
1572+ * pack whose mtime is greater than or equal to the one
1573+ * we are considering. We can thus avoid packing an
1574+ * additional copy of that object.
1575+ */
1576+ if (mtime <= candidate_mtime )
1577+ return 0 ;
1578+ }
15751579 }
15761580
15771581 return -1 ;
@@ -1624,9 +1628,9 @@ static int want_found_object(const struct object_id *oid, int exclude,
16241628 */
16251629 unsigned flags = 0 ;
16261630 if (ignore_packed_keep_on_disk )
1627- flags |= ON_DISK_KEEP_PACKS ;
1631+ flags |= KEPT_PACK_ON_DISK ;
16281632 if (ignore_packed_keep_in_core )
1629- flags |= IN_CORE_KEEP_PACKS ;
1633+ flags |= KEPT_PACK_IN_CORE ;
16301634
16311635 /*
16321636 * If the object is in a pack that we want to ignore, *and* we
@@ -1749,13 +1753,15 @@ static int want_object_in_pack_mtime(const struct object_id *oid,
17491753 }
17501754 }
17511755
1752- for (e = the_repository -> objects -> packfiles -> packs .head ; e ; e = e -> next ) {
1753- struct packed_git * p = e -> pack ;
1754- want = want_object_in_pack_one (p , oid , exclude , found_pack , found_offset , found_mtime );
1755- if (!exclude && want > 0 )
1756- packfile_list_prepend (& the_repository -> objects -> packfiles -> packs , p );
1757- if (want != -1 )
1758- return want ;
1756+ for (source = the_repository -> objects -> sources ; source ; source = source -> next ) {
1757+ for (e = source -> packfiles -> packs .head ; e ; e = e -> next ) {
1758+ struct packed_git * p = e -> pack ;
1759+ want = want_object_in_pack_one (p , oid , exclude , found_pack , found_offset , found_mtime );
1760+ if (!exclude && want > 0 )
1761+ packfile_list_prepend (& source -> packfiles -> packs , p );
1762+ if (want != -1 )
1763+ return want ;
1764+ }
17591765 }
17601766
17611767 if (uri_protocols .nr ) {
@@ -3931,7 +3937,7 @@ static void read_stdin_packs(enum stdin_packs_mode mode, int rev_list_unpacked)
39313937 * an optimization during delta selection.
39323938 */
39333939 revs .no_kept_objects = 1 ;
3934- revs .keep_pack_cache_flags |= IN_CORE_KEEP_PACKS ;
3940+ revs .keep_pack_cache_flags |= KEPT_PACK_IN_CORE ;
39353941 revs .blob_objects = 1 ;
39363942 revs .tree_objects = 1 ;
39373943 revs .tag_objects = 1 ;
@@ -4030,7 +4036,7 @@ static void show_cruft_commit(struct commit *commit, void *data)
40304036
40314037static int cruft_include_check_obj (struct object * obj , void * data UNUSED )
40324038{
4033- return !has_object_kept_pack (to_pack .repo , & obj -> oid , IN_CORE_KEEP_PACKS );
4039+ return !has_object_kept_pack (to_pack .repo , & obj -> oid , KEPT_PACK_IN_CORE );
40344040}
40354041
40364042static int cruft_include_check (struct commit * commit , void * data )
0 commit comments