On Mon, Apr 4, 2022 at 3:25 PM Shaoxuan Yuan <shaoxuan.yuan02@xxxxxxxxx> wrote: > I read and think about this part a few times, but I'm still confused. > > As Victoria pointed out earlier, and I quote, "Sparse directories *only* appear > when you're using a sparse index, so, theoretically, this shouldn't ever > come up (and thus isn't testable) until you're using a sparse index." > So I'm not so sure what do you mean by putting "full index" and "sparse > directory" together. > > Thus, I go ahead and try to detect a directory that is outside of > sparse-checkout cone, without sparse-index enabled. > > I found a problem that if you use cache_name_pos() to do this > detection, I imagined the following example (I'm trying to imitate an > output of "git ls-files -t"): > > H a > H b > S d/file1 > H e/file1 > > So in this index, I use cache_name_pos() to find a directory "c/". I imagine the > the value returned would be -3, which indicates this directory would be inserted > at index position 2. However, the cache entry at position 2 is > "d/file1", which is > marked with SKIP_WORKTREE, and this fact cannot guarantee that "c/" is > a sparse directory, since ''c/" is not in the index per se. > > Probably I'm missing something, or I'm just dumb. Though I think doing a strncmp() after the cache_name_pos() can get the job done :) -- Thanks & Regards, Shaoxuan