Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider git-created directories as sources #1420

Open
ag-eitilt opened this issue Sep 19, 2023 · 0 comments
Open

Consider git-created directories as sources #1420

ag-eitilt opened this issue Sep 19, 2023 · 0 comments
Labels
breaking-change bug Something isn't working

Comments

@ag-eitilt
Copy link
Collaborator

Currently, we populate the internal list of sources via git ls-files (if the workspace uses git). However, git only tracks files and only implicitly creates directories in order to put those files in the right places -- relevantly, the directories themselves are not returned from git ls-files and thus aren't considered Wake sources.1 Meanwhile, both source and claim are perfectly happy to load and hash directories, but since the directories aren't included under git, a clean checkout containing dir/file.txt which is trying to get a path for both the directory and the file has to use source "dir/file.txt" but claim "dir", contrary to the intuition around claim.

This does also bring up a number of further considerations:

  • We can add the directories easily enough by walking up each relative path from git ls-files and including each directory until the workspace root, but a naïve implementation risks exponential memory use if something like a list is used to store the sources rather than a tree -- I don't know the internals to say whether that's already been headed off.
  • mkdir should probably only make new directories, rather than being able to transform any path into a Path -- similar behaviour to the new write in checking the registered sources. This would be a breaking change since there could be legacy code (predating claim) which uses mkdir to load source directories, but would help to define the domain for each function.
  • Relatedly, anything which uses claim to load source directories is also going to break. I think this is less likely to impact anything because source and claim are currently assumed by many users to relate to file paths (due to the source/git interaction) and claim hasn't had as much time for niche uses like directories to develop. It could also be mitigated if source and claim are merged as part of the same release.

Footnotes

  1. This is in contrast to some other VCS models (my experience is with Darcs) which do have first-class directories, and if populated by piping the relevant listing command into publish source as recommended, we wind up in a situation where Wake's behaviour with directories sometimes requires source and sometimes claim based on what backing store is used.

@ag-eitilt ag-eitilt added bug Something isn't working breaking-change labels Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant