summaryrefslogtreecommitdiff
path: root/repository.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2021-06-17 17:13:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-06-28 16:57:41 (GMT)
commitebaf3bcf1aecdc31062ede80fca3a7c98202d8bb (patch)
tree00753eeb98e5e9e57d53cc031ec3c3846aa38de1 /repository.c
parentebf3c04b262aa27fbb97f8a0156c2347fecafafb (diff)
downloadgit-ebaf3bcf1aecdc31062ede80fca3a7c98202d8bb.zip
git-ebaf3bcf1aecdc31062ede80fca3a7c98202d8bb.tar.gz
git-ebaf3bcf1aecdc31062ede80fca3a7c98202d8bb.tar.bz2
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 <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/repository.c b/repository.c
index 448cd55..057a474 100644
--- a/repository.c
+++ b/repository.c
@@ -172,6 +172,10 @@ int repo_init(struct repository *repo,
repo_set_hash_algo(repo, format.hash_algo);
+ /* take ownership of format.partial_clone */
+ repo->repository_format_partial_clone = format.partial_clone;
+ format.partial_clone = NULL;
+
if (worktree)
repo_set_worktree(repo, worktree);