From ebaf3bcf1aecdc31062ede80fca3a7c98202d8bb Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Thu, 17 Jun 2021 10:13:22 -0700 Subject: repository: move global r_f_p_c to repo struct Move repository_format_partial_clone, which is currently a global variable, into struct repository. (Full support for per-repository partial clone config will be done in a subsequent commit - this is split into its own commit because of the extent of the changes needed.) The new repo-specific variable cannot be set in check_repository_format_gently() (as is currently), because that function does not know which repo it is operating on (or even whether the value is important); therefore this responsibility is delegated to the outermost caller that knows. Of all the outermost callers that know (found by looking at all functions that call clear_repository_format()), I looked at those that either read from the main Git directory or write into a struct repository. These callers have been modified accordingly (write to the_repository in the former case and write to the given struct repository in the latter case). Signed-off-by: Jonathan Tan Signed-off-by: Junio C Hamano Reviewed-by: Elijah Newren Signed-off-by: Junio C Hamano --- promisor-remote.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'promisor-remote.c') diff --git a/promisor-remote.c b/promisor-remote.c index da3f2ca261..d24081dc21 100644 --- a/promisor-remote.c +++ b/promisor-remote.c @@ -5,13 +5,6 @@ #include "transport.h" #include "strvec.h" -static char *repository_format_partial_clone; - -void set_repository_format_partial_clone(char *partial_clone) -{ - repository_format_partial_clone = xstrdup_or_null(partial_clone); -} - static int fetch_objects(const char *remote_name, const struct object_id *oids, int oid_nr) @@ -145,15 +138,15 @@ static void promisor_remote_init(void) git_config(promisor_remote_config, NULL); - if (repository_format_partial_clone) { + if (the_repository->repository_format_partial_clone) { struct promisor_remote *o, *previous; - o = promisor_remote_lookup(repository_format_partial_clone, + o = promisor_remote_lookup(the_repository->repository_format_partial_clone, &previous); if (o) promisor_remote_move_to_tail(o, previous); else - promisor_remote_new(repository_format_partial_clone); + promisor_remote_new(the_repository->repository_format_partial_clone); } } -- cgit v1.2.3