Merge branch 'kn/midx-wo-the-repository'
Yet another "pass the repository through the callchain" topic. * kn/midx-wo-the-repository: midx: inline the `MIDX_MIN_SIZE` definition midx: pass down `hash_algo` to functions using global variables midx: pass `repository` to `load_multi_pack_index` midx: cleanup internal usage of `the_repository` and `the_hash_algo` midx-write: pass down repository to `write_midx_file[_only]` write-midx: add repository field to `write_midx_context` midx-write: use `revs->repo` inside `read_refs_snapshot` midx-write: pass down repository to static functions packfile.c: remove unnecessary prepare_packed_git() call midx: add repository to `multi_pack_index` struct config: make `packed_git_(limit|window_size)` non-global variables config: make `delta_base_cache_limit` a non-global variable packfile: pass down repository to `for_each_packed_object` packfile: pass down repository to `has_object[_kept]_pack` packfile: pass down repository to `odb_pack_name` packfile: pass `repository` to static function in the file packfile: use `repository` from `packed_git` directly packfile: add repository to struct `packed_git`
This commit is contained in:
@@ -1291,7 +1291,7 @@ static void parse_pack_objects(unsigned char *hash)
|
||||
* recursively checking if the resulting object is used as a base
|
||||
* for some more deltas.
|
||||
*/
|
||||
static void resolve_deltas(void)
|
||||
static void resolve_deltas(struct pack_idx_option *opts)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1307,7 +1307,7 @@ static void resolve_deltas(void)
|
||||
nr_ref_deltas + nr_ofs_deltas);
|
||||
|
||||
nr_dispatched = 0;
|
||||
base_cache_limit = delta_base_cache_limit * nr_threads;
|
||||
base_cache_limit = opts->delta_base_cache_limit * nr_threads;
|
||||
if (nr_threads > 1 || getenv("GIT_FORCE_THREADS")) {
|
||||
init_thread();
|
||||
work_lock();
|
||||
@@ -1532,7 +1532,7 @@ static void write_special_file(const char *suffix, const char *msg,
|
||||
if (pack_name)
|
||||
filename = derive_filename(pack_name, "pack", suffix, &name_buf);
|
||||
else
|
||||
filename = odb_pack_name(&name_buf, hash, suffix);
|
||||
filename = odb_pack_name(the_repository, &name_buf, hash, suffix);
|
||||
|
||||
fd = odb_pack_keep(filename);
|
||||
if (fd < 0) {
|
||||
@@ -1560,7 +1560,7 @@ static void rename_tmp_packfile(const char **final_name,
|
||||
{
|
||||
if (!*final_name || strcmp(*final_name, curr_name)) {
|
||||
if (!*final_name)
|
||||
*final_name = odb_pack_name(name, hash, ext);
|
||||
*final_name = odb_pack_name(the_repository, name, hash, ext);
|
||||
if (finalize_object_file(curr_name, *final_name))
|
||||
die(_("unable to rename temporary '*.%s' file to '%s'"),
|
||||
ext, *final_name);
|
||||
@@ -1605,7 +1605,8 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
|
||||
|
||||
if (do_fsck_object) {
|
||||
struct packed_git *p;
|
||||
p = add_packed_git(final_index_name, strlen(final_index_name), 0);
|
||||
p = add_packed_git(the_repository, final_index_name,
|
||||
strlen(final_index_name), 0);
|
||||
if (p)
|
||||
install_packed_git(the_repository, p);
|
||||
}
|
||||
@@ -1656,6 +1657,10 @@ static int git_index_pack_config(const char *k, const char *v,
|
||||
else
|
||||
opts->flags &= ~WRITE_REV;
|
||||
}
|
||||
if (!strcmp(k, "core.deltabasecachelimit")) {
|
||||
opts->delta_base_cache_limit = git_config_ulong(k, v, ctx->kvi);
|
||||
return 0;
|
||||
}
|
||||
return git_default_config(k, v, ctx, cb);
|
||||
}
|
||||
|
||||
@@ -1703,7 +1708,8 @@ static void read_v2_anomalous_offsets(struct packed_git *p,
|
||||
|
||||
static void read_idx_option(struct pack_idx_option *opts, const char *pack_name)
|
||||
{
|
||||
struct packed_git *p = add_packed_git(pack_name, strlen(pack_name), 1);
|
||||
struct packed_git *p = add_packed_git(the_repository, pack_name,
|
||||
strlen(pack_name), 1);
|
||||
|
||||
if (!p)
|
||||
die(_("Cannot open existing pack file '%s'"), pack_name);
|
||||
@@ -2035,7 +2041,7 @@ int cmd_index_pack(int argc,
|
||||
parse_pack_objects(pack_hash);
|
||||
if (report_end_of_input)
|
||||
write_in_full(2, "\0", 1);
|
||||
resolve_deltas();
|
||||
resolve_deltas(&opts);
|
||||
conclude_pack(fix_thin_pack, curr_pack, pack_hash);
|
||||
free(ofs_deltas);
|
||||
free(ref_deltas);
|
||||
|
||||
Reference in New Issue
Block a user