query: fix variable shadowing in file_exists()

The loop variable "path" shadowed the function parameter of the same
name.
After populating the cache, line 103 compared the last iterated path
against the cache instead of the requested path, causing file_exists()
to incorrectly return True on the first call for any given version.

Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
This commit is contained in:
Thomas Perrot 2026-05-05 17:26:47 +02:00 committed by Théo Lebrun
parent b5b875ed0b
commit fd03fb1ed0

View file

@ -91,12 +91,12 @@ class Query:
if version not in self.file_cache:
version_cache = set()
last_dir = None
for _, path in self.db.vers.get(version).iter():
dirname, filename = os.path.split(path)
for _, file_path in self.db.vers.get(version).iter():
dirname, filename = os.path.split(file_path)
if dirname != last_dir:
last_dir = dirname
version_cache.add(dirname)
version_cache.add(path)
version_cache.add(file_path)
self.file_cache[version] = version_cache