* Check whether we want the object in the pack (e.g., we do not want * objects found in non-local stores if the "--local" option was used). * * If the caller already knows an existing pack it wants to take the object * from, that is passed in *found_pack and *found_offset; otherwise this * function finds if there is any pack that has the object and returns the pack * and its offset in these
| 1741 | * and its offset in these variables. |
| 1742 | */ |
| 1743 | static int want_object_in_pack_mtime(const struct object_id *oid, |
| 1744 | int exclude, |
| 1745 | struct packed_git **found_pack, |
| 1746 | off_t *found_offset, |
| 1747 | uint32_t found_mtime) |
| 1748 | { |
| 1749 | int want; |
| 1750 | struct packfile_list_entry *e; |
| 1751 | struct odb_source *source; |
| 1752 | |
| 1753 | if (!exclude && local) { |
| 1754 | /* |
| 1755 | * Note that we start iterating at `sources->next` so that we |
| 1756 | * skip the local object source. |
| 1757 | */ |
| 1758 | struct odb_source *source = the_repository->objects->sources->next; |
| 1759 | for (; source; source = source->next) { |
| 1760 | struct odb_source_files *files = odb_source_files_downcast(source); |
| 1761 | if (!odb_source_read_object_info(&files->loose->base, oid, NULL, 0)) |
| 1762 | return 0; |
| 1763 | } |
| 1764 | } |
| 1765 | |
| 1766 | /* |
| 1767 | * If we already know the pack object lives in, start checks from that |
| 1768 | * pack - in the usual case when neither --local was given nor .keep files |
| 1769 | * are present we will determine the answer right now. |
| 1770 | */ |
| 1771 | if (*found_pack) { |
| 1772 | want = want_found_object(oid, exclude, *found_pack, |
| 1773 | found_mtime); |
| 1774 | if (want != -1) |
| 1775 | return want; |
| 1776 | |
| 1777 | *found_pack = NULL; |
| 1778 | *found_offset = 0; |
| 1779 | } |
| 1780 | |
| 1781 | odb_prepare_alternates(the_repository->objects); |
| 1782 | |
| 1783 | for (source = the_repository->objects->sources; source; source = source->next) { |
| 1784 | struct multi_pack_index *m = get_multi_pack_index(source); |
| 1785 | struct pack_entry e; |
| 1786 | |
| 1787 | if (m && fill_midx_entry(m, oid, &e)) { |
| 1788 | want = want_object_in_pack_one(e.p, oid, exclude, found_pack, found_offset, found_mtime); |
| 1789 | if (want != -1) |
| 1790 | return want; |
| 1791 | } |
| 1792 | } |
| 1793 | |
| 1794 | for (source = the_repository->objects->sources; source; source = source->next) { |
| 1795 | struct odb_source_files *files = odb_source_files_downcast(source); |
| 1796 | |
| 1797 | for (e = files->packed->packs.head; e; e = e->next) { |
| 1798 | struct packed_git *p = e->pack; |
| 1799 | want = want_object_in_pack_one(p, oid, exclude, found_pack, found_offset, found_mtime); |
| 1800 | if (!exclude && want > 0) |
no test coverage detected