config: make delta_base_cache_limit
a non-global variable
The `delta_base_cache_limit` variable is a global config variable used by multiple subsystems. Let's make this non-global, by adding this variable independently to the subsystems where it is used. First, add the setting to the `repo_settings` struct, this provides access to the config in places where the repository is available. Use this in `packfile.c`. In `index-pack.c` we add it to the `pack_idx_option` struct and its constructor. While the repository struct is available here, it may not be set because `git index-pack` can be used without a repository. In `gc.c` add it to the `gc_config` struct and also the constructor function. The gc functions currently do not have direct access to a repository struct. These changes are made to remove the usage of `delta_base_cache_limit` as a global variable in `packfile.c`. This brings us one step closer to removing the `USE_THE_REPOSITORY_VARIABLE` definition in `packfile.c` which we complete in the next patch. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
c87910b96b
commit
d6b2d21fbf
10
packfile.c
10
packfile.c
@ -1496,7 +1496,9 @@ void clear_delta_base_cache(void)
|
||||
}
|
||||
|
||||
static void add_delta_base_cache(struct packed_git *p, off_t base_offset,
|
||||
void *base, unsigned long base_size, enum object_type type)
|
||||
void *base, unsigned long base_size,
|
||||
unsigned long delta_base_cache_limit,
|
||||
enum object_type type)
|
||||
{
|
||||
struct delta_base_cache_entry *ent;
|
||||
struct list_head *lru, *tmp;
|
||||
@ -1698,6 +1700,8 @@ void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
|
||||
int delta_stack_nr = 0, delta_stack_alloc = UNPACK_ENTRY_STACK_PREALLOC;
|
||||
int base_from_cache = 0;
|
||||
|
||||
prepare_repo_settings(p->repo);
|
||||
|
||||
write_pack_access_log(p, obj_offset);
|
||||
|
||||
/* PHASE 1: drill down to the innermost base object */
|
||||
@ -1878,7 +1882,9 @@ void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
|
||||
* before we are done using it.
|
||||
*/
|
||||
if (!external_base)
|
||||
add_delta_base_cache(p, base_obj_offset, base, base_size, type);
|
||||
add_delta_base_cache(p, base_obj_offset, base, base_size,
|
||||
p->repo->settings.delta_base_cache_limit,
|
||||
type);
|
||||
|
||||
free(delta_data);
|
||||
free(external_base);
|
||||
|
Reference in New Issue
Block a user