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

Function add_object_entry_from_pack

builtin/pack-objects.c:3787–3832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3785static int stdin_packs_hints_nr;
3786
3787static int add_object_entry_from_pack(const struct object_id *oid,
3788 struct packed_git *p,
3789 uint32_t pos,
3790 void *_data)
3791{
3792 off_t ofs;
3793 struct object_info oi = OBJECT_INFO_INIT;
3794 enum object_type type = OBJ_NONE;
3795
3796 display_progress(progress_state, ++nr_seen);
3797
3798 if (have_duplicate_entry(oid, 0))
3799 return 0;
3800
3801 stdin_packs_found_nr++;
3802
3803 ofs = nth_packed_object_offset(p, pos);
3804
3805 oi.typep = &type;
3806 if (packed_object_info(p, ofs, &oi) < 0) {
3807 die(_("could not get type of object %s in pack %s"),
3808 oid_to_hex(oid), p->pack_name);
3809 } else if (type == OBJ_COMMIT) {
3810 struct rev_info *revs = _data;
3811 /*
3812 * commits in included packs are used as starting points
3813 * for the subsequent revision walk
3814 *
3815 * Note that we do want to walk through commits that are
3816 * present in excluded-open ('!') packs to pick up any
3817 * objects reachable from them not present in the
3818 * excluded-closed ('^') packs.
3819 *
3820 * However, we'll only add those objects to the packing
3821 * list after checking `want_object_in_pack()` below.
3822 */
3823 add_pending_oid(revs, NULL, oid, 0);
3824 }
3825
3826 if (!want_object_in_pack(oid, 0, &p, &ofs))
3827 return 0;
3828
3829 create_object_entry(oid, type, 0, 0, 0, p, ofs);
3830
3831 return 0;
3832}
3833
3834static void show_object_pack_hint(struct object *object, const char *name,
3835 void *data)

Callers

nothing calls this directly

Calls 9

display_progressFunction · 0.85
have_duplicate_entryFunction · 0.85
nth_packed_object_offsetFunction · 0.85
packed_object_infoFunction · 0.85
oid_to_hexFunction · 0.85
add_pending_oidFunction · 0.85
want_object_in_packFunction · 0.85
create_object_entryFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected