Skip to content

Commit

Permalink
Cache hidden dir bug (#63)
Browse files Browse the repository at this point in the history
* fix path basename lookup

* add ignore_hidden arg to recursive _dirhash
  • Loading branch information
marshall7m authored Nov 4, 2022
1 parent a76236a commit 2e93c98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,15 @@ def _dirhash(self, directory, hash, ignore_hidden=False, excluded_extensions=[])
assert Path(directory).is_dir()
for path in sorted(Path(directory).iterdir(), key=lambda p: str(p).lower()):
if path.is_file():
if not ignore_hidden and path.basename().startswith("."):
if not ignore_hidden and path.name.startswith("."):
continue
if path.suffix in excluded_extensions:
continue
with open(path, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash.update(chunk)
elif path.is_dir():
hash = self._dirhash(path, hash)
hash = self._dirhash(path, hash, ignore_hidden=ignore_hidden)
return hash

def _cache(func):
Expand Down

0 comments on commit 2e93c98

Please sign in to comment.