delta-islands: stop depending on `the_repository`
There are multiple sites in "delta-islands.c" where we use the global `the_repository` variable, either explicitly or implicitly by using `the_hash_algo`. Refactor the code to stop using `the_repository`. In most cases this is trivial because we already had a repository available in the calling context, with the only exception being `propagate_island_marks()`. Adapt it so that the repository gets passed in via a parameter. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
f6e174b2d8
commit
19be71db9c
|
@ -3847,7 +3847,7 @@ static void show_commit(struct commit *commit, void *data UNUSED)
|
|||
index_commit_for_bitmap(commit);
|
||||
|
||||
if (use_delta_islands)
|
||||
propagate_island_marks(commit);
|
||||
propagate_island_marks(the_repository, commit);
|
||||
}
|
||||
|
||||
static void show_object(struct object *obj, const char *name,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "git-compat-util.h"
|
||||
|
@ -267,8 +266,7 @@ void resolve_tree_islands(struct repository *r,
|
|||
QSORT(todo, nr, tree_depth_compare);
|
||||
|
||||
if (progress)
|
||||
progress_state = start_progress(the_repository,
|
||||
_("Propagating island marks"), nr);
|
||||
progress_state = start_progress(r, _("Propagating island marks"), nr);
|
||||
|
||||
for (i = 0; i < nr; i++) {
|
||||
struct object_entry *ent = todo[i].entry;
|
||||
|
@ -490,9 +488,9 @@ void load_delta_islands(struct repository *r, int progress)
|
|||
|
||||
island_marks = kh_init_oid_map();
|
||||
|
||||
git_config(island_config_callback, &ild);
|
||||
repo_config(r, island_config_callback, &ild);
|
||||
ild.remote_islands = kh_init_str();
|
||||
refs_for_each_ref(get_main_ref_store(the_repository),
|
||||
refs_for_each_ref(get_main_ref_store(r),
|
||||
find_island_for_ref, &ild);
|
||||
free_config_regexes(&ild);
|
||||
deduplicate_islands(ild.remote_islands, r);
|
||||
|
@ -502,7 +500,7 @@ void load_delta_islands(struct repository *r, int progress)
|
|||
fprintf(stderr, _("Marked %d islands, done.\n"), island_counter);
|
||||
}
|
||||
|
||||
void propagate_island_marks(struct commit *commit)
|
||||
void propagate_island_marks(struct repository *r, struct commit *commit)
|
||||
{
|
||||
khiter_t pos = kh_get_oid_map(island_marks, commit->object.oid);
|
||||
|
||||
|
@ -510,8 +508,8 @@ void propagate_island_marks(struct commit *commit)
|
|||
struct commit_list *p;
|
||||
struct island_bitmap *root_marks = kh_value(island_marks, pos);
|
||||
|
||||
repo_parse_commit(the_repository, commit);
|
||||
set_island_marks(&repo_get_commit_tree(the_repository, commit)->object,
|
||||
repo_parse_commit(r, commit);
|
||||
set_island_marks(&repo_get_commit_tree(r, commit)->object,
|
||||
root_marks);
|
||||
for (p = commit->parents; p; p = p->next)
|
||||
set_island_marks(&p->item->object, root_marks);
|
||||
|
|
|
@ -12,7 +12,7 @@ void resolve_tree_islands(struct repository *r,
|
|||
int progress,
|
||||
struct packing_data *to_pack);
|
||||
void load_delta_islands(struct repository *r, int progress);
|
||||
void propagate_island_marks(struct commit *commit);
|
||||
void propagate_island_marks(struct repository *r, struct commit *commit);
|
||||
int compute_pack_layers(struct packing_data *to_pack);
|
||||
void free_island_marks(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue