diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2022-02-07 21:33:02 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-02-08 09:49:21 -0800 |
commit | 53255916b7c47a0d360841477ed9ffbc4b370284 (patch) | |
tree | 8e2bcd812355c2c88176eca3420812fd9d865b2d /t/t1002-read-tree-m-u-2way.sh | |
parent | sparse-checkout: set worktree-config correctly (diff) | |
download | tgif-53255916b7c47a0d360841477ed9ffbc4b370284.tar.xz |
worktree: copy sparse-checkout patterns and config on add
When adding a new worktree, it is reasonable to expect that we want to
use the current set of sparse-checkout settings for that new worktree.
This is particularly important for repositories where the worktree would
become too large to be useful. This is even more important when using
partial clone as well, since we want to avoid downloading the missing
blobs for files that should not be written to the new worktree.
The only way to create such a worktree without this intermediate step of
expanding the full worktree is to copy the sparse-checkout patterns and
config settings during 'git worktree add'. Each worktree has its own
sparse-checkout patterns, and the default behavior when the
sparse-checkout file is missing is to include all paths at HEAD. Thus,
we need to have patterns from somewhere, they might as well be the
current worktree's patterns. These are then modified independently in
the future.
In addition to the sparse-checkout file, copy the worktree config file
if worktree config is enabled and the file exists. This will copy over
any important settings to ensure the new worktree behaves the same as
the current one. The only exception we must continue to make is that
core.bare and core.worktree should become unset in the worktree's config
file.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1002-read-tree-m-u-2way.sh')
0 files changed, 0 insertions, 0 deletions