Thread (88 messages) 88 messages, 6 authors, 2021-09-08

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

flat view

From: Elijah Newren <hidden>
Date: 2021-08-20 16:11:16

On Fri, Aug 20, 2021 at 8:39 AM Derrick Stolee [off-list ref] wrote:
On 8/19/2021 4:53 PM, Elijah Newren wrote:
quoted
On Tue, Aug 17, 2021 at 6:23 AM Derrick Stolee via GitGitGadget
[off-list ref] wrote:
quoted
+       /*
+        * 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.
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help