This patch series includes a fix to the bug reported by Sean Allred [1] and diagnosed by Eric Sunshine [2]. The root cause is that 'git sparse-checkout init' writes to the worktree config without checking that core.bare might need to be set. This only matters when the base repository is bare, since creating the config.worktree file and enabling extensions.worktreeConfig will cause Git to treat the base repo's core.bare=false as important for this worktree. This series fixes this, but also puts in place some helpers to prevent this from happening in the future. While here, some of the config paths are modified to take a repository struct. The critical bits are in Patches 3 and 4 which introduce the helper and then consume it in builtin/sparse-checkout.c and sparse-index.c. [1] https://lore.kernel.org/git/CABceR4bZmtC4rCwgxZ1BBYZP69VOUca1f_moJoP989vTUZWu9Q@xxxxxxxxxxxxxx/ [2] https://lore.kernel.org/git/CAPig+cQ6U_yFw-X2OWrizB1rbCvc4bNxuSzKFzmoLNnm0GH8Eg@xxxxxxxxxxxxxx/ Thanks, -Stolee Derrick Stolee (4): setup: use a repository when upgrading format config: make some helpers repo-aware config: add repo_config_set_worktree_gently() sparse-checkout: use repo_config_set_worktree_gently() builtin/sparse-checkout.c | 25 +++++-------- config.c | 56 ++++++++++++++++++++++++++++-- config.h | 13 +++++++ list-objects-filter-options.c | 2 +- repository.h | 2 +- setup.c | 6 ++-- sparse-index.c | 10 ++---- t/t1091-sparse-checkout-builtin.sh | 14 +++++++- 8 files changed, 95 insertions(+), 33 deletions(-) base-commit: 69a9c10c95e28df457e33b3c7400b16caf2e2962 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1101%2Fderrickstolee%2Fsparse-checkout%2Fbare-worktree-bug-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1101/derrickstolee/sparse-checkout/bare-worktree-bug-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/1101 -- gitgitgadget