Sorry, one more thing... On Fri, Aug 27, 2021 at 2:56 PM Elijah Newren <newren@xxxxxxxxx> wrote: > > On Tue, Aug 24, 2021 at 2:51 PM Derrick Stolee via GitGitGadget > <gitgitgadget@xxxxxxxxx> wrote: > > 8: febef675f05 ! 9: c19d93ec5d7 sparse-checkout: clear tracked sparse dirs > > @@ Commit message > > the sparse directory. This depends on the indexed version of the file, > > so the sparse directory must be expanded. > > > > + We must take special care to look for untracked, non-ignored files in > > + these directories before deleting them. We do not want to delete any > > + meaningful work that the users were doing in those directories and > > + perhaps forgot to add and commit before switching sparse-checkout > > + definitions. Since those untracked files might be code files that > > + generated ignored build output, also do not delete any ignored files > > + from these directories in that case. The users can recover their state > > + by resetting their sparse-checkout definition to include that directory > > + and continue. Alternatively, they can see the warning that is presented > > + and delete the directory themselves to regain the performance they > > + expect. Will deleting the directory regain the performance they expect, or is another step needed? In other worse, will the sparsification of the paths under the no-longer-needed directory into a sparse directory entry just happen automatically as part of some other command like commit/add, or do they need to manually run `git sparse-checkout reapply`? > > + > > By deleting the sparse directories when changing scope (or running 'git > > sparse-checkout reapply') we regain these performance benefits as if the > > repository was in a clean state. > > @@ Documentation/git-sparse-checkout.txt: case-insensitive check. This corrects for > > 'git sparse-checkout set' command to reflect the expected cone in the working > > directory. > > > > -+The cone mode sparse-checkout patterns will also remove ignored files that > > -+are not within the sparse-checkout definition. This is important behavior > > -+to preserve the performance of the sparse index, but also matches that > > -+cone mode patterns care about directories, not files. If there exist files > > -+that are untracked and not ignored, then Git will not delete files within > > -+that directory other than the tracked files that are now out of scope. > > -+These files should be removed manually to ensure Git can behave optimally. > > ++When changing the sparse-checkout patterns in cone mode, Git will inspect each > > ++tracked directory that is not within the sparse-checkout cone to see if it > > ++contains any untracked files. If all of those files are ignored due to the > > ++`.gitignore` patterns, then the directory will be deleted. If any of the > > ++untracked files within that directory is not ignored, then no deletions will > > ++occur within that directory and a warning message will appear. If these files > > ++are important, then reset your sparse-checkout definition so they are included, > > ++use `git add` and `git commit` to store them, then remove any remaining files > > ++manually to ensure Git can behave optimally.