]> git.ipfire.org Git - thirdparty/git.git/commit - worktree.c
worktree: create init_worktree_config()
authorDerrick Stolee <dstolee@microsoft.com>
Mon, 7 Feb 2022 21:32:59 +0000 (21:32 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 Feb 2022 17:49:20 +0000 (09:49 -0800)
commit615a84ad788b26260c5b053ace2d5720ea5f05c5
treecc23034eaf7387cded3941887b5bd35c98127c9a
parent5c11c0d52c398af65f19bcf65a46304552083214
worktree: create init_worktree_config()

Upgrading a repository to use extensions.worktreeConfig is non-trivial.
There are several steps involved, including moving some config settings
from the common config file to the main worktree's config.worktree file.
The previous change updated the documentation with all of these details.

Commands such as 'git sparse-checkout set' upgrade the repository to use
extensions.worktreeConfig without following these steps, causing some
user pain in some special cases.

Create a helper method, init_worktree_config(), that will be used in a
later change to fix this behavior within 'git sparse-checkout set'. The
method is carefully documented in worktree.h.

Note that we do _not_ upgrade the repository format version to 1 during
this process. The worktree config extension must be considered by Git
and third-party tools even if core.repositoryFormatVersion is 0 for
historical reasons documented in 11664196ac ("Revert
"check_repository_format_gently(): refuse extensions for old
repositories"", 2020-07-15). This is a special case for this extension,
and newer extensions (such as extensions.objectFormat) still need to
upgrade the repository format version.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
worktree.c
worktree.h