This will copy over any important settings to ensure the new worktree behaves the same as the current one. In addition to the sparse-checkout file, copy the worktree config file if worktree config is enabled and the file exists. These are then modified independently in the future. Thus, we need to have patterns from somewhere, they might as well be the current worktree's patterns. 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' ( man).Įach 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. 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. This is particularly important for repositories where the worktree would become too large to be useful. 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. (Merged by Junio C Hamano - gitster - in commit 6249ce2, ) worktree: copy sparse-checkout patterns and config on add See commit 3ce1138, commit 5325591, commit 7316dc5, commit fe18733, commit 615a84a, commit 5c11c0d () by Derrick Stolee ( derrickstolee). With Git 2.36 (Q2 2022), " git sparse-checkout" ( man) wants to work with per-worktree configuration, but did not work well in a worktree attached to a bare repository. Perform that cleanup as part of the test now. This error checking would cause a failure further down the test script because of a test that adds non-cone mode patterns without cleaning them up. This is necessary for our example test 'cone mode: warn on bad pattern', but also requires modifying the example sparse-checkout file we use to test the warnings related to recognizing cone mode patterns. should behave if the existing sparse-checkout file does not match the cone mode patterns.Ĭhange the behavior to fail with an error message about the existing patterns.Īlso, all cone mode patterns start with a ' /' character, so add that restriction. When in cone mode sparse-checkout, it is unclear how ' git sparse-checkout' ( man) add. (Merged by Junio C Hamano - gitster - in commit 09481fe, ) sparse-checkout: refuse to add to bad patterns See commit a3eca58, commit 391c3a1, commit a481d43 () by Derrick Stolee ( derrickstolee). Note/Warning: Certain sparse-checkout patterns that are valid in non-cone mode led to segfault in cone mode, which has been corrected with Git 2.35 (Q1 2022). Note that with Git 2.28, git status will mention that you are in a sparse-checked-out repository It has evolved with Git 2.27 and knows how to "reapply" a sparse checkout, as in here. Nicono's answer illustrates its usage: git sparse-checkout init -cone # to fetch only root files There is now a command git sparse-checkout, that I present in detail with Git 2.25 (Q1 2020)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |