From: Junio C Hamano Date: Wed, 24 May 2023 10:25:42 GMT Subject: Re: [PATCH 0/2] Fix behavior of worktree config in submodules Message-ID: In-Reply-To: "Victoria Dye via GitGitGadget" writes: > About a year ago, discussion on the sparse index integration of 'git grep' > surfaced larger incompatibilities between sparse-checkout and submodules > [1]. This series fixes one of the underlying issues to that incompatibility, > which is that the worktree config of the submodule (where > 'core.sparseCheckout', 'core.sparseCheckoutCone', and 'index.sparse' are > set) is not used when operating on the submodule from its super project > (e.g., in a command with '--recurse-submodules'). OK. So in short, worktreeConfig used to be a singleton, global for the entire git process, but because "git grep" (and possibly others) wants to operate across repository boundary when recursing into submodules, the repository_format_worktree_config needs to be per repository instance, not a global singleton. Makes sense.