We used to use that logic in DvcTree back before we had proper trees.
Now we have a RepoTree, that combines git/workspace tree with the
DvcTree and dirty state clearly belongs to the git/workspace and not
the dvc itself, as dvc state only depends on dvc-files and lock-files.
Prerequisite for #4523
* dvc: use cache state when saving downloaded cache
Related to #4485
* tree: dont compute hash from scratch for output dirs
Fixes#4485
* tree: fix get_hash