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>
This commit is contained in:
committed by
Junio C Hamano
parent
f6e174b2d8
commit
19be71db9c
@@ -3847,7 +3847,7 @@ static void show_commit(struct commit *commit, void *data UNUSED)
|
|||||||
index_commit_for_bitmap(commit);
|
index_commit_for_bitmap(commit);
|
||||||
|
|
||||||
if (use_delta_islands)
|
if (use_delta_islands)
|
||||||
propagate_island_marks(commit);
|
propagate_island_marks(the_repository, commit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_object(struct object *obj, const char *name,
|
static void show_object(struct object *obj, const char *name,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
@@ -267,8 +266,7 @@ void resolve_tree_islands(struct repository *r,
|
|||||||
QSORT(todo, nr, tree_depth_compare);
|
QSORT(todo, nr, tree_depth_compare);
|
||||||
|
|
||||||
if (progress)
|
if (progress)
|
||||||
progress_state = start_progress(the_repository,
|
progress_state = start_progress(r, _("Propagating island marks"), nr);
|
||||||
_("Propagating island marks"), nr);
|
|
||||||
|
|
||||||
for (i = 0; i < nr; i++) {
|
for (i = 0; i < nr; i++) {
|
||||||
struct object_entry *ent = todo[i].entry;
|
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();
|
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();
|
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);
|
find_island_for_ref, &ild);
|
||||||
free_config_regexes(&ild);
|
free_config_regexes(&ild);
|
||||||
deduplicate_islands(ild.remote_islands, r);
|
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);
|
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);
|
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 commit_list *p;
|
||||||
struct island_bitmap *root_marks = kh_value(island_marks, pos);
|
struct island_bitmap *root_marks = kh_value(island_marks, pos);
|
||||||
|
|
||||||
repo_parse_commit(the_repository, commit);
|
repo_parse_commit(r, commit);
|
||||||
set_island_marks(&repo_get_commit_tree(the_repository, commit)->object,
|
set_island_marks(&repo_get_commit_tree(r, commit)->object,
|
||||||
root_marks);
|
root_marks);
|
||||||
for (p = commit->parents; p; p = p->next)
|
for (p = commit->parents; p; p = p->next)
|
||||||
set_island_marks(&p->item->object, root_marks);
|
set_island_marks(&p->item->object, root_marks);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ void resolve_tree_islands(struct repository *r,
|
|||||||
int progress,
|
int progress,
|
||||||
struct packing_data *to_pack);
|
struct packing_data *to_pack);
|
||||||
void load_delta_islands(struct repository *r, int progress);
|
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);
|
int compute_pack_layers(struct packing_data *to_pack);
|
||||||
void free_island_marks(void);
|
void free_island_marks(void);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user