fix: hold data directories while packs read them

This commit is contained in:
Abdessamad Derraz committed 2026-10-17 19:22:50 +02:00
1 parent d98f00cfbc
commit 1ffc0a6937
5 files changed
+101 -3

No files matched your search

+11 -2
View File
@@ -716,8 +716,17 @@ _data_dir_index: dict[str, dict[str, list[tuple[int, str]]]] = {}
def _data_dir_basenames(cache_dir: str) -> dict[str, list[tuple[int, str]]]:
"""Casefolded basename -> (walk order, path) of every file in a cache."""
key = os.path.realpath(cache_dir)
"""Casefolded basename -> (walk order, path) of every file in a cache.
Keyed by the tree's identity as well as its path: a refresh swaps in a
new directory under the same name, and an index of the old one named
files that were gone.
"""
try:
stat = os.stat(cache_dir)
except OSError:
return {}
key = f"{os.path.realpath(cache_dir)}:{stat.st_dev}:{stat.st_ino}"
if key not in _data_dir_index:
index: dict[str, list[tuple[int, str]]] = {}
order = 0