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

Function read_stdin_packs

builtin/pack-objects.c:4073–4132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4071static void add_unreachable_loose_objects(struct rev_info *revs);
4072
4073static void read_stdin_packs(enum stdin_packs_mode mode, int rev_list_unpacked)
4074{
4075 int prev_fetch_if_missing = fetch_if_missing;
4076 struct rev_info revs;
4077
4078 /*
4079 * The revision walk may hit objects that are promised, only. As the
4080 * walk is best-effort though we don't want to perform backfill fetches
4081 * for them.
4082 */
4083 fetch_if_missing = 0;
4084
4085 repo_init_revisions(the_repository, &revs, NULL);
4086 /*
4087 * Use a revision walk to fill in the namehash of objects in the include
4088 * packs. To save time, we'll avoid traversing through objects that are
4089 * in excluded packs.
4090 *
4091 * That may cause us to avoid populating all of the namehash fields of
4092 * all included objects, but our goal is best-effort, since this is only
4093 * an optimization during delta selection.
4094 */
4095 revs.no_kept_objects = 1;
4096 revs.keep_pack_cache_flags |= KEPT_PACK_IN_CORE;
4097 revs.blob_objects = 1;
4098 revs.tree_objects = 1;
4099 revs.tag_objects = 1;
4100 revs.ignore_missing_links = 1;
4101 revs.exclude_promisor_objects = exclude_promisor_objects;
4102
4103 /* avoids adding objects in excluded packs */
4104 ignore_packed_keep_in_core = 1;
4105 if (mode == STDIN_PACKS_MODE_FOLLOW) {
4106 /*
4107 * In '--stdin-packs=follow' mode, additionally ignore
4108 * objects in excluded-open packs to prevent them from
4109 * appearing in the resulting pack.
4110 */
4111 ignore_packed_keep_in_core_open = 1;
4112 }
4113 stdin_packs_read_input(&revs, mode);
4114 if (rev_list_unpacked)
4115 add_unreachable_loose_objects(&revs);
4116
4117 if (prepare_revision_walk(&revs))
4118 die(_("revision walk setup failed"));
4119 traverse_commit_list(&revs,
4120 show_commit_pack_hint,
4121 show_object_pack_hint,
4122 &mode);
4123
4124 release_revisions(&revs);
4125
4126 trace2_data_intmax("pack-objects", the_repository, "stdin_packs_found",
4127 stdin_packs_found_nr);
4128 trace2_data_intmax("pack-objects", the_repository, "stdin_packs_hints",
4129 stdin_packs_hints_nr);
4130

Callers 1

cmd_pack_objectsFunction · 0.85

Calls 7

repo_init_revisionsFunction · 0.85
stdin_packs_read_inputFunction · 0.85
prepare_revision_walkFunction · 0.85
traverse_commit_listFunction · 0.85
release_revisionsFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected