diff options
author | Victoria Dye <vdye@github.com> | 2023-05-26 03:33:00 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-05-26 06:53:41 +0200 |
commit | 3867f6d650c89230ae7393e2d57160ccc14758c7 (patch) | |
tree | 967a2971733b17b584c01943116e39264203f38a /worktree.c | |
parent | config: pass 'repo' directly to 'config_with_options()' (diff) | |
download | git-3867f6d650c89230ae7393e2d57160ccc14758c7.tar.xz git-3867f6d650c89230ae7393e2d57160ccc14758c7.zip |
repository: move 'repository_format_worktree_config' to repo scope
Move 'repository_format_worktree_config' out of the global scope and into
the 'repository' struct. This change is similar to how
'repository_format_partial_clone' was moved in ebaf3bcf1ae (repository: move
global r_f_p_c to repo struct, 2021-06-17), adding it to the 'repository'
struct and updating 'setup.c' & 'repository.c' functions to assign the value
appropriately.
The primary goal of this change is to be able to load the worktree config of
a submodule depending on whether that submodule - not its superproject - has
'extensions.worktreeConfig' enabled. To ensure 'do_git_config_sequence()'
has access to the newly repo-scoped configuration, add a 'struct repository'
argument to 'do_git_config_sequence()' and pass it the 'repo' value from
'config_with_options()'.
Finally, add/update tests in 't3007-ls-files-recurse-submodules.sh' to
verify 'extensions.worktreeConfig' is read an used independently by
superprojects and submodules.
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r-- | worktree.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/worktree.c b/worktree.c index b5ee71c5eb..c448fecd4b 100644 --- a/worktree.c +++ b/worktree.c @@ -806,7 +806,7 @@ int init_worktree_config(struct repository *r) * If the extension is already enabled, then we can skip the * upgrade process. */ - if (repository_format_worktree_config) + if (r->repository_format_worktree_config) return 0; if ((res = git_config_set_gently("extensions.worktreeConfig", "true"))) return error(_("failed to set extensions.worktreeConfig setting")); @@ -846,7 +846,7 @@ int init_worktree_config(struct repository *r) * Ensure that we use worktree config for the remaining lifetime * of the current process. */ - repository_format_worktree_config = 1; + r->repository_format_worktree_config = 1; cleanup: git_configset_clear(&cs); |