[BUG REPORT] sparseIndexExpanded hint always shows on sparse worktree move
- From
Brian Lyles <brianmlyles@gmail.com>
- Date
- Aug 8, 2024, 02:07 UTC
- Message-ID
- <17e99eb90d57089d.70b1dd9aae081c6e.203dcd72f6563036@zivdesk>
After updating to v2.46.0, the "sparse index is expanding to a full index" hint added in 9479a31d60 (advice: warn when sparse index expands, 2024-07-08) seems to show any time a worktree using a sparse index is moved. This is easily reproduced with the following script:
git init --initial-branch=main main-worktree
mkdir main-worktree/A main-worktree/B
touch main-worktree/A/a.txt main-worktree/B/b.txt
git -C main-worktree add .
git -C main-worktree commit -m "initial commit"
git -C main-worktree worktree add --no-checkout ../other-worktree -b other main
git -C other-worktree sparse-checkout set A --sparse-index
git -C other-worktree checkout
git -C main-worktree worktree move ../other-worktree ../other-worktree-movedIt does not appear that the index is ever actually touched. Testing in a real repository shows that the index size does not change, nor does its last modified timestamp.
I've reproduced this on Windows, MacOS, and Gentoo Linux.
-- Thank you, Brian Lyles