From 44e300a97480ef272a596e02b912b72528043193 Mon Sep 17 00:00:00 2001 From: Ayush Chandekar Date: Fri, 4 Jul 2025 19:42:34 +0530 Subject: repository: move 'repository_format_precious_objects' to repo scope The 'extensions.preciousObjects' setting when set true, prevents operations that might drop objects from the object storage. This setting is populated in the global variable 'repository_format_precious_objects'. Move this global variable to repo scope by adding it to 'struct repository and also refactor all the occurences accordingly. This change is part of an ongoing effort to eliminate global variables, improve modularity and help libify the codebase. Mentored-by: Christian Couder Mentored-by: Ghanshyam Thakkar Signed-off-by: Ayush Chandekar Signed-off-by: Junio C Hamano --- setup.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'setup.c') diff --git a/setup.c b/setup.c index f93bd6a24a..3ea01e9331 100644 --- a/setup.c +++ b/setup.c @@ -753,7 +753,8 @@ static int check_repository_format_gently(const char *gitdir, struct repository_ die("%s", err.buf); } - repository_format_precious_objects = candidate->precious_objects; + the_repository->repository_format_precious_objects = candidate->precious_objects; + string_list_clear(&candidate->unknown_extensions, 0); string_list_clear(&candidate->v1_only_extensions, 0); @@ -1864,6 +1865,8 @@ const char *setup_git_directory_gently(int *nongit_ok) the_repository->repository_format_partial_clone = repo_fmt.partial_clone; repo_fmt.partial_clone = NULL; + the_repository->repository_format_precious_objects = + repo_fmt.precious_objects; } } /* -- cgit v1.3-5-g45d5