Skip to content

Commit ecc6fa9

Browse files
peffgitster
authored andcommitted
pack-bitmap: load writer config from repository parameter
In bitmap_writer_init(), we take a repository parameter but ever look at it. Most of the initialization here is independent of the repository, but we do load some config. So let's pass the repo we get down to load_pseudo_merges_from_config(), which in turn can use repo_config(), rather than depending on the_repository via git_config(). The outcome is the same, since all callers pass in the_repository anyway. But it takes us a step closer to getting rid of the global, and as a bonus it silences an unused parameter warning. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 65e7a44 commit ecc6fa9

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

pack-bitmap-write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void bitmap_writer_init(struct bitmap_writer *writer, struct repository *r)
5151

5252
string_list_init_dup(&writer->pseudo_merge_groups);
5353

54-
load_pseudo_merges_from_config(&writer->pseudo_merge_groups);
54+
load_pseudo_merges_from_config(r, &writer->pseudo_merge_groups);
5555
}
5656

5757
static void free_pseudo_merge_commit_idx(struct pseudo_merge_commit_idx *idx)

pseudo-merge.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,12 @@ static int pseudo_merge_config(const char *var, const char *value,
183183
return ret;
184184
}
185185

186-
void load_pseudo_merges_from_config(struct string_list *list)
186+
void load_pseudo_merges_from_config(struct repository *r,
187+
struct string_list *list)
187188
{
188189
struct string_list_item *item;
189190

190-
git_config(pseudo_merge_config, list);
191+
repo_config(r, pseudo_merge_config, list);
191192

192193
for_each_string_list_item(item, list) {
193194
struct pseudo_merge_group *group = item->util;

pseudo-merge.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ struct commit;
1010
struct string_list;
1111
struct bitmap_index;
1212
struct bitmap_writer;
13+
struct repository;
1314

1415
/*
1516
* A pseudo-merge group tracks the set of non-bitmapped reference tips
@@ -72,7 +73,7 @@ struct pseudo_merge_matches {
7273
* entry keys are the pseudo-merge group names, and the values are
7374
* pointers to the pseudo_merge_group structure itself.
7475
*/
75-
void load_pseudo_merges_from_config(struct string_list *list);
76+
void load_pseudo_merges_from_config(struct repository *r, struct string_list *list);
7677

7778
/*
7879
* A pseudo-merge commit index (pseudo_merge_commit_idx) maps a

0 commit comments

Comments
 (0)