Repository navigation
Various gitignore fixes - #11017
Various gitignore fixes#11017
Conversation
c836e91 to
f282fbd
Compare
| dagql.Arg("include").Doc(`Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).`), | ||
| dagql.Arg("noCache").Doc(`If true, the directory will always be reloaded from the host.`), | ||
| dagql.Arg("noGitAutoIgnore").Doc(`Don't apply .gitignore filter rules inside the directory`), | ||
| dagql.Arg("gitignore").Doc(`Apply .gitignore filter rules inside the directory`), |
There was a problem hiding this comment.
The big change here is this.
I want to make this opt-in - we made a breaking change accidentally, and I think it's worth backing out of that. Since this API cannot be called by modules, it's outside module-compat so we should be fine for that.
This makes more sense with the approach we're going for now; we only need to add it for module loading, instead of needing to opt out for flag loading, and for context directories, and tests, etc.
There was a problem hiding this comment.
@shykes can I get a check here?
Since we all agreed on the API before, wanna make sure I get everyone involved with that original discussion on board here.
There was a problem hiding this comment.
Yes I'm on board. Technically this should be gitAutoIgnore for consistency with past bikeshedding, but I'm going to assume this is your personal preference, and drop that particular nit 😁
There was a problem hiding this comment.
Yup, I don't think we need the auto in there - it's not automatic anymore, you need to enable it, so I think we should remove that, and just keep it to gitignore.
865c318 to
fe517f1
Compare
fe517f1 to
3778cb2
Compare
8533db7 to
c539c2d
Compare
Signed-off-by: Justin Chadwell <[email protected]>
This was a weird one - if you forcefully excluded loading gitignore
while attempting to apply the gitignore, you could get inconsistent
results.
Assuming strictly serial uploads this was fine, but in parallel, we're
very careful to ensure that the shared file store is in a consistent
state.
For example, suppose:
- From /src, we upload a large a.txt (using include=a.txt)
- From /src in parallel, we upload a .gitignore containing a.txt (using
exclude=.gitignore, and applying gitignore)
- The expected outcome is to not upload a.txt
- But, because a.txt is in the local copy and the gitignore is *not* (we
skipped uploading it), then we incorrectly will copy a.txt to our
snapshot.
The *core* problem here is that we are effectively applying
includes+excludes and gitignores *twice*. First when uploading, and
second when we copy to our snapshot.
We can fix this! Instead of applying the patterns again on the second
copy, we know *exactly* what files need to be copied (based on the
transfer results), so can just include those.
Signed-off-by: Justin Chadwell <[email protected]>
Update syncParentDirs to always sync over gitignores. This ensures that
the gitignore patterns between local/remote *always* match.
This wasn't previously true, and so could have potentially meant that we
were removing files that were still being used. Imagine the scenario:
- We upload a large a.txt, excluded by gitignore, but gitignore not applied
- We upload something else, and apply gitignore (but avoid transferring
the gitignore, by excluding the gitignore file in a pattern)
- This will remove a.txt, because now local has no idea that it
should be excluded.
- If we upload the same a.txt again, we'll have to do it again from
scratch.
This is all weird, so instead of this, we'll just first sync *all* the
gitignores, so that the context perfectly matches. This actually
resolves the same problem as the prior commit - but also resolves the
above issue. Technically, this would work by itself, but the additional
copy is still confusing and should still be removed.
Signed-off-by: Justin Chadwell <[email protected]>
This reverts commit e3d1b4b. Signed-off-by: Justin Chadwell <[email protected]>
And apply it to module loading. Signed-off-by: Justin Chadwell <[email protected]>
It turns out to be much *cheaper* to apply gitignores after include/exclude. e.g. we might come to exclude a huge directory - in that case, it's not worth looking for gitignore patterns in there. So we can filter that out before. But we still use the original filesystem for matching! That way, we can't accidentally exclude the gitignore. Signed-off-by: Justin Chadwell <[email protected]>
c539c2d to
380792d
Compare
Fixes #10994 and other related issues.
See individual commits for detailed explanation.