diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-06-20 15:53:13 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-06-20 15:53:13 -0700 |
| commit | 7cb4274d2606775b0d5b373756f76f386a31bb64 (patch) | |
| tree | 4b3ddb8b70ec60ca3ff8402c9924ef547f717a65 /setup.c | |
| parent | 9cd234e6465ab2bea5c402f0d9ee1495501250ef (diff) | |
| parent | 3867f6d650c89230ae7393e2d57160ccc14758c7 (diff) | |
| download | git-7cb4274d2606775b0d5b373756f76f386a31bb64.tar.xz | |
Merge branch 'vd/worktree-config-is-per-repository'
The value of config.worktree is per-repository, but has been kept
in a singleton global variable per process. This has been OK as
most Git operations interacted with a single repository at a time,
but not right for operations like recursive "grep" that want to
access multiple repositories from a single process without forking.
The global variable has been eliminated and made into a member in
the per-repository data structure.
* vd/worktree-config-is-per-repository:
repository: move 'repository_format_worktree_config' to repo scope
config: pass 'repo' directly to 'config_with_options()'
config: use gitdir to get worktree config
Diffstat (limited to 'setup.c')
| -rw-r--r-- | setup.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -650,11 +650,10 @@ static int check_repository_format_gently(const char *gitdir, struct repository_ } repository_format_precious_objects = candidate->precious_objects; - repository_format_worktree_config = candidate->worktree_config; string_list_clear(&candidate->unknown_extensions, 0); string_list_clear(&candidate->v1_only_extensions, 0); - if (repository_format_worktree_config) { + if (candidate->worktree_config) { /* * pick up core.bare and core.worktree from per-worktree * config if present @@ -1423,6 +1422,9 @@ int discover_git_directory(struct strbuf *commondir, return -1; } + the_repository->repository_format_worktree_config = + candidate.worktree_config; + /* take ownership of candidate.partial_clone */ the_repository->repository_format_partial_clone = candidate.partial_clone; @@ -1560,6 +1562,8 @@ const char *setup_git_directory_gently(int *nongit_ok) } if (startup_info->have_repository) { repo_set_hash_algo(the_repository, repo_fmt.hash_algo); + the_repository->repository_format_worktree_config = + repo_fmt.worktree_config; /* take ownership of repo_fmt.partial_clone */ the_repository->repository_format_partial_clone = repo_fmt.partial_clone; @@ -1651,6 +1655,8 @@ void check_repository_format(struct repository_format *fmt) check_repository_format_gently(get_git_dir(), fmt, NULL); startup_info->have_repository = 1; repo_set_hash_algo(the_repository, fmt->hash_algo); + the_repository->repository_format_worktree_config = + fmt->worktree_config; the_repository->repository_format_partial_clone = xstrdup_or_null(fmt->partial_clone); clear_repository_format(&repo_fmt); |
