Re: [PATCH 3/4] config: add repo_config_set_worktree_gently()
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Dec 20, 2021, 17:32 UTC
- Message-ID
- <6d72a020-ded7-6ef2-825c-ce6421194b26@gmail.com>
- In-Reply-To
- <67993f6cff254d341ba4ad7fe7709b57eb3e74d4.1640015844.git.gitgitgadget@gmail.com>
On 12/20/2021 10:57 AM, Derrick Stolee via GitGitGadget wrote:
> From: Derrick Stolee <dstolee@microsoft.com>
...
Show 11 quoted lines
> + /*
> + * Ensure that core.bare reflects the current worktree, since the
> + * logic for is_bare_repository() changes if extensions.worktreeConfig
> + * is disabled.
> + */
> + if ((res = git_config_set_multivar_in_file_gently(config_filename, "core.bare",
> + r->worktree ? "false" : "true",
> + NULL, 0))) {
> + error(_("unable to set core.bare setting in worktree config"));
> + return res;
> + }As mentioned by Eric, this portion isn't correct. It fixes _this_ worktree, but any other existing worktrees would become broken.
The fix would be to detect if the core config file has core.bare=false and then to move that setting into the base repo's config.worktree file.
I believe that if we do that change, then the rest of this patch series is valid.
What do others think?
Thanks, -Stolee