MCPcopy Index your code
hub / github.com/git/git / add_objects_by_path

Function add_objects_by_path

builtin/pack-objects.c:4734–4785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4732}
4733
4734static int add_objects_by_path(const char *path,
4735 struct oid_array *oids,
4736 enum object_type type,
4737 void *data)
4738{
4739 size_t oe_start = to_pack.nr_objects;
4740 size_t oe_end;
4741 unsigned int *processed = data;
4742
4743 /*
4744 * First, add all objects to the packing data, including the ones
4745 * marked UNINTERESTING (translated to 'exclude') as they can be
4746 * used as delta bases.
4747 */
4748 for (size_t i = 0; i < oids->nr; i++) {
4749 int exclude;
4750 struct object_info oi = OBJECT_INFO_INIT;
4751 struct object_id *oid = &oids->oid[i];
4752
4753 /* Skip objects that do not exist locally. */
4754 if ((exclude_promisor_objects || arg_missing_action != MA_ERROR) &&
4755 odb_read_object_info_extended(the_repository->objects, oid, &oi,
4756 OBJECT_INFO_FOR_PREFETCH) < 0)
4757 continue;
4758
4759 exclude = is_oid_uninteresting(the_repository, oid);
4760
4761 if (exclude && !thin)
4762 continue;
4763
4764 add_object_entry(oid, type, path, exclude);
4765 }
4766
4767 oe_end = to_pack.nr_objects;
4768
4769 /* We can skip delta calculations if it is a no-op. */
4770 if (oe_end == oe_start || !window)
4771 return 0;
4772
4773 ALLOC_GROW(to_pack.regions,
4774 to_pack.nr_regions + 1,
4775 to_pack.nr_regions_alloc);
4776
4777 to_pack.regions[to_pack.nr_regions].start = oe_start;
4778 to_pack.regions[to_pack.nr_regions].nr = oe_end - oe_start;
4779 to_pack.nr_regions++;
4780
4781 *processed += oids->nr;
4782 display_progress(progress_state, *processed);
4783
4784 return 0;
4785}
4786
4787static int get_object_list_path_walk(struct rev_info *revs)
4788{

Callers

nothing calls this directly

Calls 4

is_oid_uninterestingFunction · 0.85
add_object_entryFunction · 0.85
display_progressFunction · 0.85

Tested by

no test coverage detected