Git fork

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>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
19be71db f6e174b2

+8 -10
+1 -1
builtin/pack-objects.c
··· 3847 3847 index_commit_for_bitmap(commit); 3848 3848 3849 3849 if (use_delta_islands) 3850 - propagate_island_marks(commit); 3850 + propagate_island_marks(the_repository, commit); 3851 3851 } 3852 3852 3853 3853 static void show_object(struct object *obj, const char *name,
+6 -8
delta-islands.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 1 #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" ··· 267 266 QSORT(todo, nr, tree_depth_compare); 268 267 269 268 if (progress) 270 - progress_state = start_progress(the_repository, 271 - _("Propagating island marks"), nr); 269 + progress_state = start_progress(r, _("Propagating island marks"), nr); 272 270 273 271 for (i = 0; i < nr; i++) { 274 272 struct object_entry *ent = todo[i].entry; ··· 490 488 491 489 island_marks = kh_init_oid_map(); 492 490 493 - git_config(island_config_callback, &ild); 491 + repo_config(r, island_config_callback, &ild); 494 492 ild.remote_islands = kh_init_str(); 495 - refs_for_each_ref(get_main_ref_store(the_repository), 493 + refs_for_each_ref(get_main_ref_store(r), 496 494 find_island_for_ref, &ild); 497 495 free_config_regexes(&ild); 498 496 deduplicate_islands(ild.remote_islands, r); ··· 502 500 fprintf(stderr, _("Marked %d islands, done.\n"), island_counter); 503 501 } 504 502 505 - void propagate_island_marks(struct commit *commit) 503 + void propagate_island_marks(struct repository *r, struct commit *commit) 506 504 { 507 505 khiter_t pos = kh_get_oid_map(island_marks, commit->object.oid); 508 506 ··· 510 508 struct commit_list *p; 511 509 struct island_bitmap *root_marks = kh_value(island_marks, pos); 512 510 513 - repo_parse_commit(the_repository, commit); 514 - set_island_marks(&repo_get_commit_tree(the_repository, commit)->object, 511 + repo_parse_commit(r, commit); 512 + set_island_marks(&repo_get_commit_tree(r, commit)->object, 515 513 root_marks); 516 514 for (p = commit->parents; p; p = p->next) 517 515 set_island_marks(&p->item->object, root_marks);
+1 -1
delta-islands.h
··· 12 12 int progress, 13 13 struct packing_data *to_pack); 14 14 void load_delta_islands(struct repository *r, int progress); 15 - void propagate_island_marks(struct commit *commit); 15 + void propagate_island_marks(struct repository *r, struct commit *commit); 16 16 int compute_pack_layers(struct packing_data *to_pack); 17 17 void free_island_marks(void); 18 18