Background: recently setup a new laptop, and zip'd my repo up from the previous laptop and unzipped on the new laptop. Everything else seems to be working fine. I've never made a sparse checkout in this repo or on this machine.
$ git status
On branch develop
Your branch is up to date with 'origin/develop'.
You are in a sparse checkout with 100% of tracked files present.
$ git sparse-checkout list
warning: this worktree is not sparse (sparse-checkout file may not exist)
$ tree .git/info
.git/info
├── exclude
└── refs
I'm using worktrees, so I created a new worktree but it gives the same results. The above commands were run from the main worktree dir.
I found the command to disable a sparse checkout, but it doesn't appear to affect anything:
$ git sparse-checkout disable
$ git sparse-checkout disable --global
$ git status
On branch develop
Your branch is up to date with 'origin/develop'.
You are in a sparse checkout with 100% of tracked files present.
I'm pretty sure I could simply reclone the repo to make it go away, but I want to make sure this doesn't keep happening.
Update
Running git config --get --bool core.sparsecheckout does print true, and the git config --list --show-origin shows that it's coming from the local .git/config file where I can see it's indeed true. After running git sparse-checkout disable and immediately cat'g the file, I can see the value remains unchanged. Permissions on that file are 644 which I believe is ok.
While looking at .git/config closer, I saw extensions.worktreeConfig = true, though I don't have a corresponding config.worktree (I am using worktrees though). I ran git config extensions.worktreeConfig false and that value IS reflected in the file. Yet, if I run git sparse-checkout disable again, it resets extensions.worktreeConfig back to true.
On a whim, I ran git config core.sparsecheckout false and that seems to have made the expected change -- and even better, extensions.worktreeConfig retained its value. And yes, git status no longer mentions a "sparse checkout", which is great.
This is all on git v2.28.0. The docs page for git sparse-checkout states: THIS COMMAND IS EXPERIMENTAL, so maybe I should take them seriously and consider this a bug :)