Skip to content

tree: don't save hash twice #4314

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

Merged
merged 1 commit into from
Jul 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions dvc/tree/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def get_dir_hash(self, path_info, **kwargs):
raise RemoteCacheRequiredError(path_info)

dir_info = self._collect_dir(path_info, **kwargs)
return self._save_dir_info(dir_info, path_info)
return self._save_dir_info(dir_info)

def hash_to_path_info(self, hash_):
return self.path_info / hash_[0:2] / hash_[2:]
Expand Down Expand Up @@ -343,7 +343,7 @@ def _collect_dir(self, path_info, **kwargs):
# Sorting the list by path to ensure reproducibility
return sorted(result, key=itemgetter(self.PARAM_RELPATH))

def _save_dir_info(self, dir_info, path_info):
def _save_dir_info(self, dir_info):
hash_, tmp_info = self._get_dir_info_hash(dir_info)
new_info = self.cache.tree.hash_to_path_info(hash_)
if self.cache.changed_cache_file(hash_):
Expand All @@ -352,8 +352,6 @@ def _save_dir_info(self, dir_info, path_info):
tmp_info, new_info, mode=self.cache.CACHE_MODE
)

if self.exists(path_info):
self.state.save(path_info, hash_)
self.state.save(new_info, hash_)

return hash_
Expand Down