Re: [RFC PATCH v2 2/4] config: load the correct config.worktree file
From: Junio C Hamano <hidden>
Date: 2020-05-12 23:22:58
Matheus Tavares Bernardino [off-list ref] writes:
quoted
Can we add a test or two to protect this fix from future breakages?Sure! There are already a couple tests, in the following patch, that check this behavior *indirectly*. As we recurse into submodules, in grep, we try to retrieve the core.sparseCheckout setting for each submodule (which is stored in the subrepo's config.worktree file). The said tests make sure we can get this setting, and they indeed fail without this patch. But would it be better to also add a more direct test, in this patch? I think we could do so by adding a new test helper that prints submodules' configs, from the superproject, and then testing the presence of per-worktree configs in the output.
Sounds like a plan. Yes, checking by observing how grep that recurses into submodules behave is doable but is indirect, and if any other subcommand that may want to do the recursion will have the same issue that gets fixed by this patch, it's better to ensure that the fix applies to any subcommand in a more direct way. Thanks.