-
Couldn't load subscription status.
- Fork 1.3k
remote: use separate working tree instance for local cache #3991
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
Conversation
dvc/state.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After remote/cache/tree separation, the only default tree (aka cache.tree) that local cache is working on will be the work tree, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct
* repo tree (CleanTree) instance should not be relevant to local cache operations. When the dvcignore CleanTree is relevant, repo.tree should be used. For local remote/cache operations, the local remote work_tree should be used.
f58bf4a to
9c59e62
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| repo = local_cache.repo | ||
| self.repo = repo | ||
| self.root_dir = repo.root_dir | ||
| self.tree = WorkingTree(self.root_dir) | ||
| self.tree = local_cache.tree.work_tree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pmrowla State itself has nothing to do with the cache, but rather with the repos working tree, right? So maybe we should have work_tree(or wtree) in repo itself and make local cache and state use it? Just not quite obvious why state depends on local cache here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed to me that since state is only applicable whenever there is a local cache, and used as a cache for calculating md5s which will go into the local cache, it would make more sense to have state associated with the local cache's working tree rather than with a repo tree instance. The repo doesn't actually need a working tree to function (since we can use git trees), but local cache and state only use a working tree.
β I have followed the Contributing to DVC checklist.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here. If the CLI API is changed, I have updated tab completion scripts.
β I will check DeepSource, CodeClimate, and other sanity checks below. (We consider them recommendatory and don't expect everything to be addressed. Please fix things that actually improve code or fix bugs.)
Thank you for the contribution - we'll try to review it as soon as possible. π
Related to #3882
repo.treeis working or git treerepo.tree