Re: [PATCH v3 6/8] attr: be careful about sparse directories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 20, 2021 at 8:39 AM Derrick Stolee <stolee@xxxxxxxxx> wrote:
>
> On 8/19/2021 4:53 PM, Elijah Newren wrote:
> > On Tue, Aug 17, 2021 at 6:23 AM Derrick Stolee via GitGitGadget
> > <gitgitgadget@xxxxxxxxx> wrote:
> >> +       /*
> >> +        * In the case of cone-mode sparse-checkout, getting the
> >> +        * .gitattributes file from a directory is meaningless: all
> >> +        * contained paths will be sparse if the .gitattributes is also
> >> +        * sparse. In the case of a sparse index, it is critical that we
> >> +        * don't go looking for one as it will expand the index.
> >> +        */
> >
> > "all contained paths will be sparse if the .gitattributes is also sparse"?
> >
> > Do you mean something more like "the .gitattributes only applies for
> > files under the given directory, and if the directory is sparse, then
> > neither the .gitattributes file or any other file under that directory
> > will be present" ?
>
> Yes, you understand correctly and explain it better. Thanks.
>
> > Also, out of curiosity, I was suggesting in the past we do something
> > like this for .gitignore files, for the same reason.  Do we have such
> > logic in place, or is that another area of the code that hasn't been
> > handled yet?
>
> I don't believe this has been handled. It definitely is less obvious
> what to do there, because the point of .gitignore is to skip files that
> exist in the working tree even if Git didn't put them there. Meanwhile,
> .gitattributes is about how Git writes tracked files, but Git doesn't
> write sparse tracked files.

Well, one advantage of deleting ignored files in sparse directories
when we sparsify, is that we know if any files are left, they are all
untracked and not ignored.  So we don't need to load the .gitignore
file for those sparse directories.

Sure, there's a small edge case of users adding new untracked files
that would have matched the .gitignore file, but it's also clear that
they removed the .gitignore file when they sparsified, so I don't see
a problem in reporting it as untracked while that directory was
as-sparsified-away-as-possible.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux